Home » HTML » HTML_QuickForm » Bug #4302
Errors not being registered to Smarty renderer with server side validation
Details
| Submitted | 2005-05-07 03:41 UTC |
|---|---|
| From | marquis at interbaun dot com |
| Status | Bogus |
| Package | HTML_QuickForm |
| PHP Version | 5.0.3 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2005-05-07 03:41 UTC] marquis at interbaun dot com
Description:
------------
Server side validation seems to work ($form->validate() will return false), but no error message or error flags will be passed to the smarty renderer.
I have read the complete manual looking for hints or examples, but I am doing this as per the manual. Could the validate function not be setting the errors in the Smarty Renderer? Is anyone using the server side validation with the Smarty renderer?
Reproduce code:
---------------
$form->addElement('text', 'price', 'Price:');
// 3. Add Validation
$form->addRule('price', 'The price is missing.', 'required', null);
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('form_data', $renderer->toArray());
if($form->validate()) {
//echo Do something
$smarty->display("success.tpl");
exit;
}else $smarty->display("error.tpl");
Expected result:
----------------
I would expect the form_data->errors array to contain data, as well as the error value for each element that has an error to be set.
Actual result:
--------------
If the price form element is left blank (rule fails), the smarty with display the error.tpl template however the smarty array has no error message nor error flags set. It is impossible to determine where the error was.