Forum

Thread tagged as: Question, Addons, Forms

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 Rose

John Rose 6 points

  • 6 years ago

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.


<perch:form id="lost_found" method="post" app="perch_forms"> <div class="radio_wrap"> <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> <div> <perch:label for="date">Date</perch:label> <perch:input id="date" type="date" required="true" label="Date the Item was Lost or Found" required="true" placeholder="Date is required"/> <perch:error for="date" type="required">Enter the date.</perch:error> </div> <div> <perch:label for="item">A short description<span class="red">*</span></perch:label> <perch:input id="item" type="text" label="Please enter a short description of the item" required="true" placeholder="Short description, please."/> <perch:error for="item" type="required">Add a short description.</perch:error> </div> <div> <perch:label for="select">Select from one of the following three items:</perch:label> <perch:input type="select" id="select" options="I want a small slice of pie, I want a big slice of pie, I want the whole pie" /> </div> <div> <perch:input type="submit" id="submitfile" value="Submit" /> </div> <perch:success> <div class="alert success"> <perch:content id="success" type="textarea" label="Thank you message" markdown="true" editor="markitup" divider-before="The following will be appear in response to a Lost and Found Form being successfully submitted." /> </div> </perch:success> </perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried with the label attribute?

John, that's the answer...

<perch:input id="choose" type="radio" label="Lost and Found" options="Lost|lost,Found|found" />

but the docs show this... https://docs.grabaperch.com/docs/form/template-tags/input/select/

<perch:input type="select" options="Small|s,Medium|m,Large|l" />

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.