Forum
Show radio button results in Perch Forms submit results
I added a radio button to a form. How would I get the result of a selection to show up in the Apps -> Forms results?
The same would go for type="select".
The use case is a lost-and-found form where most of the questions are the same, and the radio results will show the editor whether the submission is for a lost or a found item.
<perch:form id="lost_found" method="post" app="perch_forms" role="form">
<div class="radiowrapper">
<perch:label for="choose">Are you reporting a lost or a found item?</perch:label>
<perch:input id="choose" type="radio" name="Lost and Found" options="Lost,Found" />
</div>
</perch:form>
Diagnostics:
Diagnostics report HEALTH CHECK
Perch is up to date PHP 5.6.10 is up to date MySQL 5.5.42 is up to date Image processing available SUMMARY INFORMATION
Perch: 2.8.14, PHP: 5.6.10, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 3c688b6bbc30d36af3ac34fdd4b7b5b787fe5555 $, with PDO Server OS: Darwin, apache2handler Installed apps: content (2.8.14), assets (2.8.14), categories (2.8.14), perch_forms (1.8.3) App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', ); PERCH_LOGINPATH: /perch PERCH_PATH: /Applications/MAMP/htdocs/wtowers/perch PERCH_CORE: /Applications/MAMP/htdocs/wtowers/perch/core PERCH_RESFILEPATH: /Applications/MAMP/htdocs/wtowers/perch/resources Image manipulation: GD PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M Resource folder writeable: Yes HTTP_HOST: wtowers.dev DOCUMENT_ROOT: /Applications/MAMP/htdocs/wtowers REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
John, I just did some testing with perch_forms and I'll be darned... Select and Radio fields are not being saved to the database when the form is submitted. I added a text field and it was the only field to show in the database.
If this isn't a new found bug, it's sure got me stumped.
Thanks for checking that out, Robert- much appreciated.
John, I just want to let you know I'm not sure this behavior is normal... I say this because I have other forms which have select fields which do show up in my form results.
I tested to see if calling the form through perch_form('template') and a form within a content region returned different results, but both methods tested were missing the select field results. So I guess I'm saying there is still a problem which needs to be worked out with Drew and Rachel.
I fiddled with it but couldn't get the type="radio" or "select" to show up in the successfully submitted results. I see that type="date" works fine. I'll paste a bit more of the code with various types in case that might help.
Have you tried with the
label
attribute?John, that's the answer...
but the docs show this... https://docs.grabaperch.com/docs/form/template-tags/input/select/
Which does not work... But the simple answer is It works with label and thats what I was using in all my working forms.
Success!
Re-checking the documentation, I see that "label" is shown in the Radio and Select Field type docs, but I missed it there. It's not shown in the Radio and Select Input sections, so I made a note on those pages.
In neither case is it highlighted that it is necessary for rendering in the Forms App results.
Many thanks for the help! I believe I have one other post to the forum on another item before I move my first Perch site to staging.
Hope Drew's not upset that I gave you a point, Robert. I thought I might be able to give one to each of you.