Jump to content

Javascript to check a regular expression in Caspio


Recommended Posts

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?

Link to comment
Share on other sites

  • 6 months later...

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...