Hi all,
If I have multiple fields being validated. How can I display all the errors all at once on a continuous list?
Here's what I have so far
Together with the CAPTCHA error, it displays something like this
1. You have entered an incorrect verification code at the bottom of the form.
2. Please select a subject below.
Address field is required.
How can I display multiple error messages with a continuous number list?
Thanks
If I have multiple fields being validated. How can I display all the errors all at once on a continuous list?
Here's what I have so far
<?php
$errors = array();
if ($_POST['subject'] == ''){
$errors[] = 'Please select a subject below.';
}
if ($_POST['address'] == ''){
$errors[] = 'Address field is required.';
}
if (count($errors)){
$errors = implode('<br/>', $errors);
return $errors;
}
?>
Together with the CAPTCHA error, it displays something like this
1. You have entered an incorrect verification code at the bottom of the form.
2. Please select a subject below.
Address field is required.
How can I display multiple error messages with a continuous number list?
Thanks
Hi WhiteLighter01,
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
Bob
Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.
Bob
Sorry, I forgot to mention the version. Its 3.2
Hi WhiteLighter01,
I'm not sure if you can. This might work:
Bob
I'm not sure if you can. This might work:
<?php
$errors = false;
$subject = JRequest::getString('subject', '', 'post');
if ( !$subject) {
$MyForm->addErrorMsg('Please select a subject below.');
$errors = true;
}
$address = JRequest::getString('address', '', 'post');
if ( !$address ){
$MyForm->addErrorMsg('Address field is required.');
$errors = true;
}
if ( $errors ) {
return 'Please correct the errors shown here';
}
?>
Bob
Thanks,
It worked ^_^ I did replaced the colons ":" with a semi-colon ";" :p
It worked ^_^ I did replaced the colons ":" with a semi-colon ";" :p
This topic is locked and no more replies can be posted.