How do you format submit errors in Form Builder?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
harleyquinn
Forum Members
Forum Members
Posts: 36
Joined: Fri Dec 22, 2006 4:29 pm

How do you format submit errors in Form Builder?

Post by harleyquinn »

Using Form Builder 0.3 and was wondering how to format the errors that output when a user doesn't fill out the form correctly? Do I need to create a UDT and attach it to OnFormBuilderFormSubmitError under Extensions > Events?

Has anyone else been able to format the errors, and if so, how did you do it?

Thanks in advance,
HQ
harleyquinn
Forum Members
Forum Members
Posts: 36
Joined: Fri Dec 22, 2006 4:29 pm

Re: How do you format submit errors in Form Builder?

Post by harleyquinn »

Ok I almost have it, but not quite there. I found which file to modify by reading the feature requests in the Forge. In form.class.php, look for this line:

Code: Select all

$message .= "<h4>".$this->module_ptr->Lang('please_enter_a_value',$this->Fields[$i]->GetName())."</h4>\n";
I tried to replace it with this:

Code: Select all

$message .= "<div id='form_errors'><p>Error(s)!</p><ul><li>".$this->module_ptr->Lang('please_enter_a_value',$this->Fields[$i]->GetName())."</li></ul></div>";


but it outputs like this:

Code: Select all

<div id='form_errors'><p>Error(s)!</p><ul><li>Please enter a value for "Name"</li></ul></div>
<div id='form_errors'><p>Error(s)!</p><ul><li>Please enter a value for "Email"</li></ul></div>
<div id='form_errors'><p>Error(s)!</p><ul><li>Please enter a value for "Subject"</li></ul></div>
<div id='form_errors'><p>Error(s)!</p><ul><li>Please enter a value for "Feedback"</li></ul></div>
and looks like this:
Error(s)!
Please enter a value for "Name"
Error(s)!
Please enter a value for "Email"
Error(s)!
Please enter a value for "Subject"
Error(s)!
Please enter a value for "Feedback"

Not quite what I was looking for.

What I want it to output is:

Code: Select all

<div id="form_errors">
<p>Error(s)!</p>
	<ul>
		<li>Please enter a value for "Name"</li>
		<li>Please enter a value for "Email"</li>
		<li>Please enter a value for "Subject"</li>
		<li>Please enter a value for "Feedback"</li>
	</ul>
</div>
and to look like this on the form page:
Error(s)!
Please enter a value for "Name"
Please enter a value for "Email"
Please enter a value for "Subject"
Please enter a value for "Feedback"

What should I change in the code to get it to do this? Anyone?
Post Reply

Return to “CMSMS Core”