Forums

Match Fields?

CyberWoolf 22 Aug, 2007
Hello,

Im trying to make my form check the email address match before continuing. So it would be like enter your email.. then the next field would be re-enter your email.

Thanks
Max_admin 22 Aug, 2007
You can't achieve this with the validation added at V2.3, you can do so with your own JS code, many JS examples and samples are posted here through the forum, if you can't get a working code from them then please let us know and we will try to show an example🙂

Cheers

max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
CyberWoolf 22 Aug, 2007
Thanks for the reply.. I tried searching the forum but I wasnt getting the right results.. IE.. nothing that remotely came close :-D

Do you know offhand any posts?

Thanks for the speedy reply btw
Max_admin 23 Aug, 2007
Please look at this one :


js validation
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
CyberWoolf 23 Aug, 2007
Oh.. I know how to validate things.. but what Im having a problem with is matching up the 2 email fields.

IE

Enter Your email

Please re-enter your email

and having them match up. It works fine if there is an error (tells me they dont match up) but when everything is correct it the submit button doesnt submit anything and just sits there staring at me saying.. why did you click me?? :-D
Max_admin 23 Aug, 2007
show me your js code and show me where do you call it please🙂
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Garza 12 Feb, 2008
Ok.. I have the same question

I want to "compare" two email fields (email1 and email2) and let the submitter know if they are different before sending the form, just like the validation does but, i do know NOTHING about javascript...

Can someone post a sample code of what i should do, AND, where is should put the code?
GreyHead 12 Feb, 2008
Hi Garza,

I don't know much about Javascript either. There is an option in the Validation code used by ChronoForms to add custom validations and one of these is "equalToField", so I guess it should be possible.

If I have time I'll take a look - can you please send me your form so that I can test with it. Take a Form Backup in the Form Manager and email it to me at the address in my sig.

Bob
Garza 15 Feb, 2008
Hello GrayHead,

I just emailed you the form backup
form was sent from email at bellsouth.net
topic:
ChronoFroms - Forum Thread - COMPARE two email fields before sending form

Thanks for your time!!

Garza
GreyHead 21 Feb, 2008
Hi Garza,

Sorry this has taken a while but I think I have a fix for you.

Open validation.js and go to the end. The last few lines are:
  ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
    var p = elm.parentNode;
    var options = p.getElementsByTagName('INPUT');
    return $A(options).any(function(elm) {
    return $F(elm);
  });
}],
]);
just before the last line insert a new line like this
  ['validate-one-required', 'Please select one of the above options.', function (v,elm) {
    var p = elm.parentNode;
    var options = p.getElementsByTagName('INPUT');
    return $A(options).any(function(elm) {
    return $F(elm);
    });
    }],
  ['validate-match', 'Emails do not match', { equalToField : 'email1' } ]
]);
Then modify the email2 input tag in your Form HTML to read:
<input name="email2" type="text" id="email2" class="required validate-match validate-email" size="50" />
and finally remove any mention of 'email2' from the Validation tab (ChronoForms isn't yet clever enough to merge two class attributes).

Bob
This topic is locked and no more replies can be posted.