Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    simple form errors

    I am trying to alter code which I have been left with to provide error messages if details are not entered correctly into an username/password retrieval form.

    if the email is not valid obviously an error message gets returned,
    however I am struggling with the password field, called 'membership'. If the field is valid and no corrsponding email address is found the user is sent to a contact form, but at present if we input letters instead of numbers we get a coldfusion error instaed of the java message.

    the code for this is:

    // function check retrieval form
    function chkRetrieveForm() {
    thisForm = document.getElementById("RetrieveForm");
    var errorinfo = "";
    var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\"[^\"\\]+\"))@((\[(([0-1]?[0-9]{1,2}\.)|(2[0-4][0-9]\.)|(25[0-5]\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    var retval = true;
    if (!thisForm.email.value.length && !thisForm.membership.value.length) {
    retval = false;
    errorinfo += "\n * Please complete either;\n\nThe E-mail field with your 'Registered E-Mail Address'\n\nor\n\nThe Membership Field with your 'Membership Number'.\n";
    }
    if (thisForm.email.value.length && thisForm.email.value.search(regex) == -1) {
    retval = false;
    thisForm.email.value = "";
    errorinfo += "\n * Please complete the E-mail field with a valid E-mail Address.\n";
    }
    if (thisForm.membership.value.length && thisForm.membership.type) {
    retval=false;
    thisForm.membership.value= "";
    errorinfo += "\n * Please enter your correct membership details or contact the IBA.\n";
    }
    if (errorinfo != "") {
    errorinfo = errorinfo + "\n\n";
    thisForm.item(0).focus();
    alert(errorinfo);
    }
    return retval;
    }
    // end



    any help would be much appreciated.

  • #2
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    problem solved


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •