How to compare two e-mail addresses on bizform
This article shows how to compare two e-mail addresses on bizform to make sure, that the e-mail address is correct.
1. Please add two field of e-mail type to your bizform in
CMSDesk -> Tools -> BizForms -> edit -> Fields. Note their code names.
2. Add
OnBeforeSave event handler to your bizform´s code-behind (
protected void viewBiz_OnBeforeSave()).
3. You can use this code, where “
Email” and “
ValidateEmail” are code-names of your e-mail fields.
protected void viewBiz_OnBeforeSave()
{
CMS.FormControls.FormEngineUserControl em1 = (CMS.FormControls.FormEngineUserControl)viewBiz.BasicForm.FieldControls
["Email"];
CMS.FormControls.FormEngineUserControl em2 = (CMS.FormControls.FormEngineUserControl)viewBiz.BasicForm.FieldControls
["ValidateEmail"];
string EmailAddress = em1.Value.ToString();
string ValidateEmailAddress = em2.Value.ToString();
if (EmailAddress != ValidateEmailAddress)
{
Response.Write("E-mail addresses must match!");
this.viewBiz.StopProcessing = true;
}
}
See also: devnet.kentico.com/docs/devguide/modifying_the_code_of_standard_web_parts.htmApplies to: Kentico CMS 4.x