I'm using Freeform Pro composer to build a form. Validating with inline error messages.

Template code


I have an email field that is required. The email Field Type is text and the Field Content Type is set to email.

If I submit the form without any data in the email field I get a message "Please fill in this field".

If I fill in the field with text that's not a valid email address, I would like it to display a message telling them a valid email address is required.

Is this something that can be done without any additional coding?



1 Answer 1


2 options, one is adding server side validation which will involve extending all sorts of internal's, the other which I feel you'd like is to use a HTML5 email type field (freeform uses a text field for the email import).

You can do this easily, please see this example that I am currently using on a site :

        attr:placeholder="Enter your email here..."}
    {if freeform:error:email}<p>{freeform:error:email}</p>{/if}

This produces the email field as so :

<input type="email" placeholder="Enter your email here..." size="36" required="required" maxlength="150" id="email" value="" name="email">

Note this is client side validation, HTML5 validation only! But the server side option can be alot more complex! the irony is that CodeIgnitor has a valid_email filter, it's just that Freeform doesn't seem to use it!

  • Thanks Blatant, That seems to be what I need. I'm not sure how/where to add it to my Composer template. Could you please let me know where to add it?
    – Deswork
    Apr 29, 2015 at 14:18
  • I'm not familiar with composer, but that syntax is freeform field syntax , if you look to the composer documentation, right at the bottom it details how to add the "required" html5 attribute, you can use the same technique for the placeholder, type and other attributes detailed.
    – Blatant
    Apr 29, 2015 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.