lockedgroove Posted March 11, 2013 Report Share Posted March 11, 2013 Hello, I'm trying to implement a Javascript that would check a textbox to see if the text inside matches a regular expression. This is what I currently have: function checkEmail(email) { if (!(email.value.match(\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\)) { return true; } else { alert("incorrect email format"); return false; } } e_s = document.getElementById('Submit'); e_s.onclick = function () { if (checkEmail(document.getElementById('InsertRecordemailAddress'))) { e_s.submit(); } else { return false; } It looks like nothing happens when I put this in the Datapage that requires it. Is there anything I'm missing in regards to linking Javascript with Caspio's elements? Quote Link to comment Share on other sites More sharing options...
MayMusic Posted March 11, 2013 Report Share Posted March 11, 2013 There is an Email form element in Configure Fields screen that you can select for the email field to make sure it is being entered correctly. Quote Link to comment Share on other sites More sharing options...
lockedgroove Posted March 11, 2013 Author Report Share Posted March 11, 2013 That would work for the email address field, but what if I wanted to check for different things, such as an IP Address or credit card number. I have multiple uses for a regular expression in my application and for this example I used the email as an example. Quote Link to comment Share on other sites More sharing options...
webmaestro Posted September 19, 2013 Report Share Posted September 19, 2013 +1 to enable Regular Expressions for validating FORM elements. A close second would be for Caspio to offer a few different form field types like Email: - ZIP code & ZIP+4 - Credit Card - Phone number 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.