vanderLeest Posted February 14, 2018 Report Share Posted February 14, 2018 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; Quote Link to comment Share on other sites More sharing options...
MayMusic Posted February 14, 2018 Report Share Posted February 14, 2018 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; } } vanderLeest 1 Quote Link to comment Share on other sites More sharing options...
vanderLeest Posted March 5, 2018 Author Report Share Posted March 5, 2018 Thanks MayMusic This worked great Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.