Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorstrangepl
    • CommentTimeNov 20th 2007
     
    Hi folks,
    I would like to validate email addresses on a form i.e. type an address in twice and validate that they are the same constructed in a propper format. Is this possible? By the way formassembly is absolutely fabulous and has blown me away big time. I am a 4 hour old member.


    Regards,

    strangepl
    • CommentAuthorcedsav
    • CommentTimeNov 20th 2007
     
    First, thank you for your kind words.

    You can specify in the Form Builder that a field should be validated as an email, but the only way to force two fields to be identical is to use a custom javascript function.

    The following instructions are recommended for expert users only.

    1/ Find in the HTML source code the id attribute of the two fields you want to validate as being identical.

    2/ Copy and paste the following in the "Custom Code" field in the form's advanced properties tab (in the Form Builder), make sure to set the values for fieldId and confirmFieldId.

    <script type="text/javascript">
    var fieldId = "enter here the id of the first field";
    var confirmFieldId = "enter here the id of the confirmation field";
    wFORMS.behaviors.validation.messages['isIdentical'] = "The values don't match.";

    // leave the rest as is.
    wFORMS.behaviors.validation.rules['isIdentical'] = { selector: "#"+fieldId,
    check: function(element) {
    var c=document.getElementById(confirmFieldId);
    if(element.value!=c.value) {
    return false;
    }
    return true;
    }};
    </script>

    3/ Save and test.
    • CommentAuthorthecgroup
    • CommentTimeNov 20th 2007
     
    Thanks for the question & answer. While I was thinking it you were asking the question. --DC (2 Hour Member)