Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Understanding Validate error array

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
geoB
Smarty Regular


Joined: 09 Sep 2010
Posts: 46

PostPosted: Fri Dec 02, 2011 3:05 pm    Post subject: Understanding Validate error array Reply with quote

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
View user's profile Send private message
geoB
Smarty Regular


Joined: 09 Sep 2010
Posts: 46

PostPosted: Fri Dec 02, 2011 4:54 pm    Post subject: Figured it out Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP