Jump to content
vanderLeest

Validation of standard fields on Comment, Request or Registration Form

Recommended Posts

I am trying to make a simple "Submit a Request" form,

which will  have fields like first name, Last name, email address, phone number, request, etc.

Field names are like C_FirstName, C_Surname, C_Email, C_Phone, C_Request 

I want to validate text entries in the following fields as follows:

First / Last name: No numerical characters are allowed

Email Address : authenticate email according to https://www.w3resource.com/javascript/form/email-validation.php

mobile no.: formatting and checking as per 

 

So far I have the phone script working, but my adaptation of the email script (or the combination of the two in the footer of the form) doesn't check the entry in the Email Address field.

Any help sincerely appreciated

Floris

 

W3's  ValidateEmail Script below:

function ValidateEmail(mail)

{

if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.emailAddr.value))

{

return (true)

}

alert("You have entered an invalid email address!")

return (false)

}
document.getElementById("caspioform").onsubmit=validateEmail;

Share this post


Link to post
Share on other sites

In your submission or update page for Email field you can select EMAIL special element  from Form Element dropdown. To not let user enter numbers

 

To prevent user from entering numbers for First_name field on submission page you can have:

 

document.getElementById('InsertRecordFirst_Name').onkeyup= function(v_e){

v_e = v_e || window.event;
   
    if (v_e.keyCode > 47 && v_e.keyCode< 58) {

       this.value = this.value.substr(0, this.value.length - 1);
return false;
    }
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...