Hi,
How do you validate a confirm email field in a custom email form? Pasted below is the code that I am using.
function ContactForm() {
// Create fields
$fields = new FieldSet(
new TextField('Name', 'Name*'),
new NumericField('Number', 'Number in Party*'),
new DropdownField('Time', 'Preferred Time', array(
'12:30pm' => '12:30pm',
'1:00pm' => '1:00pm',
'1:30pm' => '1:30pm'
)),
new TextField('Telephone', 'Contact number*'),
new EmailField('Email', 'Email address*'),
new EmailField('CEmail', 'Confirm email address*'),
);
// Create action
$actions = new FieldSet(
new FormAction('SendContactForm', 'Send')
);
// Create Validators
$validator = new RequiredFields('Name', ,'Telephone', 'Email');
return new Form($this, 'ContactForm', $fields, $actions, $validator);
}