I am trying to add in the following custom validation into my form:
When I place the code in the onload event it works, but when I place it onto the on submit it is not working. What am I missing?
I am using the default form validation on most to the fields, but I have this special case where you are asked to either enter an email address or phone number. Would using the default form validation be interfering with the custom validation?
Thanks,
Ed
<?php
$error_count = 0;
$phone = $form->data['phone'];
$email = $form->data['email'];
if ( !$phone && !$email ) {
$form->validation_errors['phone'] = 'Please enter an email or phone number';
$error_count++;
}
if ( $error_count ) {
return false;
}
?>
When I place the code in the onload event it works, but when I place it onto the on submit it is not working. What am I missing?
I am using the default form validation on most to the fields, but I have this special case where you are asked to either enter an email address or phone number. Would using the default form validation be interfering with the custom validation?
Thanks,
Ed