CodeCharge Studio | All ASP PHP Perl ColdFusion Java C#.NET VB.NET |
This example shows how to validate a field value using the form's On Validate event. In this case we have a Registration Record form in which the value of the Password field should be identical to the value of the Confirm field.
Function Registration_OnValidate(Sender) If Registration.Password.Value <> Registration.Confirm.Value Then Registration.Errors.addError("The values of Password and Confirm fields do not match.") End if End Function
function Registration_OnValidate(& $sender) { global $Registration; if ($Registration->Password->GetValue() != $Registration->Confirm->GetValue()) { $Registration->Errors->addError("The values of Password and Confirm fields do not match."); } }
sub Registration_OnValidate() { if ($Registration->{Password}->{Value} ne $Registration->{Confirm}->{Value}) { $Registration->{Errors}->addError("The values of Password and Confirm fields do not match."); } }
<!---Registration_OnValidate---> <CFIF fldPassword NEQ fldConfirm> <CFSET strErrRegistration=strErrRegistration & "<br>" & "The values of Password and Confirm fields do not match."> </CFIF>
'Registration_OnValidate If Password.Value <> Confirm.Value Then errors.Add("Password","The values of Password and Confirm fields do not match.") End if
//Registration_OnValidate if ((Password.Value != null && Confirm.Value != null) && (Password.Value.ToString() != Confirm.Value.ToString() )) { errors.Add("Password","The values of Password and Confirm fields do not match."); }
//Registration_OnValidate if ( e.getRecord().getControl("Password").getValue() != null && ! e.getRecord().getControl("Password").getValue().equals( e.getRecord().getControl("Confirm").getValue())) { e.getRecord().addError("The values in fields Password and Confirm do not match."); }