Email field validation not working for <cfinput>

Participant ,
Sep 02, 2015 Sep 02, 2015

Copy link to clipboard

Copied

My form has input fields for first and last names and for an email address. Form validation for email is not working people are entering First Name" 1, Last Name: 1, and email: 1 and the action for the form is completing without catching the error.

The action  invokes a <CFMail> to send the information to the office manager.

Any thoughts?.

Views

418

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Engaged , Sep 03, 2015 Sep 03, 2015
Are people really entering "1" into the form or are bots (or PCI scanners) posting those values directly to your action script?  Prior to sending CFMail, perform an server-side isValid("email") check to ensure that it's actually a valid email address.Regarding the use of CFINPUT, I'd recommend using an alternative like jQuery Validation plugin.  You'll have more control over the validation and gain skills that you can apply to any HTML (even static).http://jqueryvalidation.org/

Likes

Translate

Translate
LEGEND ,
Sep 02, 2015 Sep 02, 2015

Copy link to clipboard

Copied

First thought would be to check the browser error console to see if there are any messages.

Second thought would be (please don't hate me), "don't use cfinput; use regular form and inputs and use JavaScript IN ADDITION TO server-side validation."

V/r,

^_^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 03, 2015 Sep 03, 2015

Copy link to clipboard

Copied

Follow Wolfshade's suggestion.

Just to help you check, the following simple code works as expected:

<cfdump var="#form#">

<cfform>

  E-mail: <cfinput type="text" name="email" validate="email" message="Enter valid e-mail address."><br>

  First name: <cfinput type="text" name="fname" validate="regex" pattern="[a-zA-Z]{2}" message="First name must contain at least 2 letters."><br>

  Last name: <cfinput type="text" name="lname" validate="regex" pattern="[a-zA-Z]{2}" message="Last name must contain at least 2 letters."><br>

  <cfinput type="submit" name="sbmt" value="Send">

</cfform>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Sep 03, 2015 Sep 03, 2015

Copy link to clipboard

Copied

LATEST

Are people really entering "1" into the form or are bots (or PCI scanners) posting those values directly to your action script?  Prior to sending CFMail, perform an server-side isValid("email") check to ensure that it's actually a valid email address.

Regarding the use of CFINPUT, I'd recommend using an alternative like jQuery Validation plugin.  You'll have more control over the validation and gain skills that you can apply to any HTML (even static).

http://jqueryvalidation.org/

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines