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 ?
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
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 :-)
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; }
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
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
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
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
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
Very cool.
Thank you for your help.
Didier
I've actually dug up a sample of the code I used, hope you'll find it usefull:
is working on a reply...