Forum

Thread tagged as: Question

[Forms] Returning the number of submitted responses

Hi,

I have a form used across multiple pages in the site. The form has a field type="hidden" which gets the slug of the current page – so that I have a way to sort results based on pages when I look at the CSV.

I'm trying to show the number of submitted responses in the site, based on the value of the hidden field.

The idea is to show that there has been 10 responses on page portfolio/item1 and 15 responses on portfolio/item2 for instance. I am not trying to show on the site the content of the responses, only the numbers.

Not sure this is possible?

Many thanks, Robin

Robin Pick

Robin Pick 5 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

The Forms app doesn't have anything like that at the moment.

Drew McLellan said:

The Forms app doesn't have anything like that at the moment.

My request is pretty specific I guess. Thanks anyway!

Alternatively, I could make a sql request to the table 'perch2_forms_responses' to get the count of rows. Would this create a conflict issue with Perch? Does Perch provides a helper to make easy use of sql request?

If I can get the count of rows through the sql request, I will be able to use PerchSystem::set_var() to output the number on the template.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can use PerchDB:

https://docs.grabaperch.com/api/perchdb/