Hi,
I'd like to run some php for server-side validation. I can get it to run, I can get it to verify correctly, I can get it to repopulate just fine.
But all it does is show one message in the red box with a #1 by it, and that's only when I "return $message". How do I get:
1. The error list-style to go away so I can format my own list, or
2. The existing structure to take in an array of error messages so it will output them in the red error box list styles?
Thanks...
I'd like to run some php for server-side validation. I can get it to run, I can get it to verify correctly, I can get it to repopulate just fine.
But all it does is show one message in the red box with a #1 by it, and that's only when I "return $message". How do I get:
1. The error list-style to go away so I can format my own list, or
2. The existing structure to take in an array of error messages so it will output them in the red error box list styles?
Thanks...
Hi jenstechs,
You can either (a) add the error messages into a singe message and return that:
Bob
You can either (a) add the error messages into a singe message and return that:
<?php
$errors = array();
if ( validation 1 ) {
$errors[] = 'Error message 1';
}
if ( validation 2) {
$errors[] = 'Error message 2';
}
. . .
if ( count($errors) ) {
$errors = implode('<br />', $errors);
return $errors;
}
or (b) you coudl use Joomla $mainframe->enqueuemessage('message', 'error'); to return your messages provided that your template supports the display of system messages.Bob
If I use an array separated by BRs, it's still going to appear in the red box as a single list, right? They're all going to appear under #1. Ideally I'd like to be able to add the messages as #2, 3, 4... Do you think if I pass it just the array, it would understand to parse that as the list? In other words, I'm sure the system code knows how to product multiple LIs, I just need to find out how it's done.
I will also try the joomla mainframe error. I would just pass that as php code for each message? But then probably each message would be in a separate box...
I will also try the joomla mainframe error. I would just pass that as php code for each message? But then probably each message would be in a separate box...
Hi jenstechs,
I'm fairly certain that the ChronoForms code won't parse an array in the return message. It might be possible to add entries directly to the ChronoForms error array. You'd need to dig for the code though.
Bob
I'm fairly certain that the ChronoForms code won't parse an array in the return message. It might be possible to add entries directly to the ChronoForms error array. You'd need to dig for the code though.
Bob
That's what I was worried about. It would be extremely beneficial if the code would parse an array... I wonder where in the codebase I'd look for that??
Hi jenstech,
Components/com_chronocontact/libraries/chronform.php function checkServerValidation() around line 252 - includes the line $MyForm->addErrorMsg($returnval);
Bob
Components/com_chronocontact/libraries/chronform.php function checkServerValidation() around line 252 - includes the line $MyForm->addErrorMsg($returnval);
Bob
This topic is locked and no more replies can be posted.