[ic] Comparing form fields

Jamie Neil jamie at versado.net
Fri Sep 10 14:14:56 EDT 2004

Ethan Rowe wrote:
> I just barely went through the delight of figuring this out.  You can do 
> it with a form profile to get the error message you want, somewhat 
> inelegantly.  You an [if] to compare the two variables; for instance, 
> the following uses an explicit type if to strip off leading and trailing 
> whitespace, then matches them.  You could do a standard [if] with no 
> perl to compare them, but they really have to be an exact match to work.

Thanks for the reply - of course I found a solution 5 minutes before I 
got your email :).

In case you are interested, here it is:

   <input type="hidden" name="mv_form_profile" value="check_values">


   [error name=password std_label="Choose a Password" required=1]
   <input type="password" name="password" value="[value password]" 
size="16" maxlength="16">

   [error name=verify std_label="Confirm Password" required=1]
   <input type="password" name="verify" value="[value verify]" size="16" 


   [set check_values]
   [if type=value term=password op=ne compare="[value verify]"]
   &calc=delete $CGI->{verify}; 1;
   verify=mandatory Passwords do not match[/if]

Credit to Ed:


Jamie Neil | <jamie at versado.net> | 0870 7777 454
Versado I.T. Services Ltd. | http://versado.net/ | 0845 450 1254

More information about the interchange-users mailing list