PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Email Input Validation. Always required?

  1. eecreative

    I have a number of email address inputs in my form that are NOT required. I want them to be optional, but I also want them—if the user chooses to fill them in—to be validated as syntactically correct email addresses in order to keep my database clean, which is why I didn't use plain text inputs.

    However, it seems that Gravity Forms won't allow this, it fails to submit because it seems email inputs won't accept a null value, even if required is set to false. Is this true, or am I doing something wrong?

    A secondary issue, and this is just something to note for the future release of HTML5 placeholder attribute support ... is that if I wanted to have a default value populated and then cleared on focus (in lieu of a label), then I currently have to use Javascript to do so. But the problem with the email inputs (or any content type that undergoes validation) is that this prepopulated value is then validated against (vs. being excluded if the input never received focus), even if the input is optional. So, the workaround (until placeholder support is available) is to use the "description" field and position it inside the input, then clear it with Javascript on focus of the input. Anyway, just wanted to note this, since it's kind of awkward, and it's still dependent on the primary issue in this ticket.

    Posted 12 years ago on Friday September 9, 2011 | Permalink
  2. Email fields are not required. They will validate properly if no value is entered and the field is not required.

    If however you are using a default value in the email field as a placeholder and the user doesn't change it, that will trigger the email validation.

    I would double check your settings and make sure the field is configured properly because there ar no known issues with required field validation with the Email field.

    Posted 12 years ago on Friday September 9, 2011 | Permalink
  3. eecreative

    Yeah, confirmed. Thanks!

    I had a default value set, but despite clearing it with Javascript, it still triggered the validation initially until I replaced with the "description" field on every input. I suspect it may have just been poor scripting on my part in clearing the value.

    Posted 12 years ago on Friday September 9, 2011 | Permalink
  4. Good to hear, glad you got it resolved!

    Posted 12 years ago on Friday September 9, 2011 | Permalink

This topic has been resolved and has been closed to new replies.