Forum

Thread tagged as: Forms

Perch:error not displaying

I'm having trouble getting the perch:error content to display when a required form field is left blank. Instead of the custom error text in perch:error, the browser displays a generic "Fill out this field" message. The form functions in every other way, successfully logging entries. I'm stumped. Anyone else running into this?

<perch:form id="contact" method="post" app="perch_forms" class="form">

<div class="row"> <div class="small-12 medium-6 columns"> <perch:label for="name">Your Name</perch:label> <perch:input type="text" id="name" required="true" label="Name" /> <perch:error for="name" type="required">Please include your name</perch:error> </div>

<div class="small-12 medium-6 columns">
    <perch:label for="email">Your Email</perch:label>
    <perch:input type="email" id="email" required="true" label="Email" />
    <perch:error for="email" type="format">Please check your email address</perch:error>
    <perch:error for="email" type="required">Please include your email address</perch:error>
</div>

</div>

<perch:input type="submit" id="submit" name="submit" class="medium button warning" value="SEND" />

</perch:form>

Perch: 3.0, PHP: 7.0.6, MySQL: 5.5.53, with PDO Server OS: Linux, cgi-fcgi Installed apps: content (3.0), assets (3.0), categories (3.0), perch_blog (5.5), perch_forms (1.9), perch_members (1.6), perch_twitter (3.7) App runtimes: <?php $apps_list = array( 'perch_blog', 'perch_twitter', 'perch_forms', 'perch_members', ); PERCH_LOGINPATH: /perch PERCH_PATH: /nfs/c05/h05/mnt/70481/domains/dev-consulting.org/html/perch PERCH_CORE: /nfs/c05/h05/mnt/70481/domains/dev-consulting.org/html/perch/core PERCH_RESFILEPATH: /nfs/c05/h05/mnt/70481/domains/dev-consulting.org/html/perch/resources Image manipulation: GD PHP limits: Max upload 200M, Max POST 200M, Memory: 99M, Total max file upload: 99M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: Yes HTTP_HOST: dev-consulting.org.s70481.gridserver.com DOCUMENT_ROOT: /home/70481/domains/dev-consulting.org/html REQUEST_URI: /perch/core/settings/diagnostics/ SCRIPT_NAME: /perch/core/settings/diagnostics/index.php

Franz Neumann

Franz Neumann 0 points

  • 1 year ago
Drew McLellan

Drew McLellan 2636 points
Perch Support

That's your browser validating the form before it's even sent to the server (and therefore Perch) for validation.

Ah. Thanks, Drew.

For anyone else wanting the perch:error text to show up instead of browser validation, add novalidate="novalidate" to your perch:form tag.

Drew McLellan

Drew McLellan 2636 points
Perch Support

Although considering how much utility the browser validation provides, that might not be the best idea in terms of UX.