Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Didier 25 posts 90 karma points
    Jun 25, 2009 @ 03:02
    Didier
    0

    Auto Form Plus - Confirmation Fields ?

    Hello,

    My client wants me to create a microsite for somekind of lottery. It is a very simple site that has a form with which people can apply to participate in the lottery. I directly thought of building the microsite using Umbraco and looked around for an extension. Auto Form Plus seems to be the closest solution to my problem.

    Now the problem is that the client wants the user to enter two email fields, one to be saved and one for confirmation. How do I do this with the Auto Form Plus macro ?

    Thank you.

    Didier

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Jun 25, 2009 @ 10:20
    Ismail Mayat
    0

    Didier,

    The doc2form which is the latest version of autoform has the ability to send confirmation email so your better off using that instead of autoform. You can get it from codeplex

    Regards

     

    Ismail

  • Didier 25 posts 90 karma points
    Jun 25, 2009 @ 17:51
    Didier
    0

    Hello Ismail,

    I knew I didn't express myself right :).

    I was talking about a very common validation.

    Email: [                              ]

    Confirm Email: [                              ]

    OR

    Password: [                                     ]

    Confirm Password: [                                ]

    How do I add the ability to validate that the user entered the same info in both the "email" and the "confirm email" fields?

     

    Thank you.

    Didier

  • Casey Neehouse 1339 posts 483 karma points MVP 2x admin
    Jun 25, 2009 @ 19:29
    Casey Neehouse
    100

    hi didier,

    You would need to make a custom datatype that included the compare validator on it. 

    Second option is to use two fields, and use a JS validation framework over the built in .NET validators.

    Unfortunately, Doc2Form or Autoform Plus neither do that directly, as the option is not available in the current set of data types.

    Case

  • Soeren Sprogoe 575 posts 259 karma points
    Jun 25, 2009 @ 20:28
    Soeren Sprogoe
    100

    I Didier,

    I've done this once for a client.

    What I did was to add some javascript functionality to the Doc2Form (latest name of the Autoform package) after it was rendered.

    The functionality basically added itself to the form's onSubmit event, checked to see if the two fields where similar, and displayed a window.alert if not.

    It's definately a "hack", not pretty, but it works and is fast to implement :-)

    /SoerenS

  • Didier 25 posts 90 karma points
    Jun 25, 2009 @ 20:32
    Didier
    0

    Very cool.

    Thank you for your help.

    Didier

  • Soeren Sprogoe 575 posts 259 karma points
    Jun 25, 2009 @ 20:38
    Soeren Sprogoe
    0

    I've actually dug up a sample of the code I used, hope you'll find it usefull:

    var elm = document.forms[0];

    if (elm.addEventListener)
    {
    elm.addEventListener('submit', CheckEmail, false);
    }
    else if (elm.attachEvent)
    {
    var r = elm.attachEvent('onsubmit', CheckEmail);
    }

    function CheckEmail()
    {
    var elm1 = GetElement("addressEmail");
    var elm2 = GetElement("addressEmailRepeat");
    if (elm1.value != elm2.value)
    {
    alert("<?UMBRACO_MACRO macroAlias="GetDictionary" item="alertEmailRepeat"></?UMBRACO_MACRO>");
    return false;
    }
    else return true;
    }

    function GetElement(elmname)
    {
    var i;
    var oForm = document.forms[0];
    var itemcount = oForm.length;

    for (i=0;i<itemcount;i++)
    {
    if (oForm.elements[i].name != null)
    {
    if (oForm.elements[i].name.indexOf(elmname)>0)
    {
    return oForm.elements[i];
    }
    }
    }
    return null;
    }

Please Sign in or register to post replies

Write your reply to:

Draft