![Smarty Forum Index Smarty Forum Index](templates/smarty/images/phpbb2_logo.gif) |
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
geoB Smarty Regular
Joined: 09 Sep 2010 Posts: 46
|
Posted: Fri Dec 02, 2011 3:05 pm Post subject: Understanding Validate error array |
|
|
I'm just getting started with SmartyValidate v3 so please forgive my density. The validations work as expected until I use append as in Code: | {validate id="first" message="First name may not be empty" append="error"} |
It is not sufficient to add to the form template Code: | {foreach from=$error key="key" item="val"}
field: {$key} error: {$val}
{/foreach} |
Where and how are the error messages assigned to $error ?
Thanks.
George |
|
Back to top |
|
geoB Smarty Regular
Joined: 09 Sep 2010 Posts: 46
|
Posted: Fri Dec 02, 2011 4:54 pm Post subject: Figured it out |
|
|
The code Code: | {foreach from=$error key="key" item="val"}
field: {$key} error: {$val}
{/foreach} | needs to follow Code: | {validate id="first" message="First name may not be empty" assign="error"}
{validate id="last" message="Last name may not be empty" append="error"}
{validate id="birthday" message="Date of birth is not a valid date" append="error"} |
g |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|