Forum

Thread tagged as: Question, Problem, Forms

Form input type number

I am trying to add the form type 'number' to the Perch forms but it is not working, I just get a blank. If I try it without the perch label it works.

e.g this works

 <li>
 <label for="Num">Number of people</label>
<input id="Num" type="number" name="Num" value="0"/>
 </li>

this does not work

<li>
<perch:label for="Num">Number of people</perch:label>
<perch:label id="Num" type="number" name="Num" value="0"/>
</li>
Perch Runway: 3.1.1, PHP: 7.2.8, MySQL: 10.0.34-MariaDB, with PDO
Server OS: Linux, litespeed
Installed apps: content (3.1.1), assets (3.1.1), categories (3.1.1), perch_blog (5.6.1), perch_forms (1.11), perch_gallery (2.8.9), perch_kraken (1.1), chirp_seo (1.2.1), redfinch_logger (1.0.1), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_forms', 'perch_gallery', 'perch_mailchimp', 'chirp_seo', 'redfinch_logger', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/robertsd/public_html/perch
PERCH_CORE: /home/robertsd/public_html/perch/core
PERCH_RESFILEPATH: /home/robertsd/public_html/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 50M, Max POST 50M, Memory: 128M, Total max file upload: 50M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
HTTP_HOST: robertsdesign.biz
DOCUMENT_ROOT: /home/robertsd/public_html
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
David Roberts

David Roberts 0 points

  • 3 years ago

You have perch:label instead of perch:input for the input tag in your example

Your example is:

<perch:label id="Num" type="number" name="Num" value="0"/>

And it should be:

<perch:input id="Num" type="number" name="Num" value="0"/>

I actually had that, which does not work, made a mistake in the example above.

             <li><perch:label for="number">Number of People</perch:label>
            <perch:input  type="number" id="number" required label="true" name="number" value="0"  placeholder=""/>
            <perch:error for="number" type="required">Please add number of people</perch:error>
           </li>
Simon Clay

Simon Clay 127 points

Your code in the most recent code you posted works for me in Perch 3.1.1 (not Runway).

Are you using this code in a Content region. Be sure to re-save the region in Admin to update it.

Thanks, Simon, that worked. Should have checked that myself.

On a related matter can you send the details of the form straight to an email address as well as having them displayed as form responses in Perch?

Simon Clay

Simon Clay 127 points

Yes indeed. The 'Form Options' tab will allow you to choose whether to 'Store responses' and/or 'Send response via email'.

Simon, Thanks. Yes, I tried both of those already, neither of them is working, so maybe its a server issue. I set up mailtrap and nothing is coming through, so it might be an issue with the server.

Thanks for your help.

David