Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Validate append="var" suggestion

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
Isidor128
Smarty Regular


Joined: 27 Jul 2004
Posts: 35
Location: France

PostPosted: Wed Jul 28, 2004 12:44 pm    Post subject: Validate append="var" suggestion Reply with quote

Hi

Using the append option is useful for grouping error messages
Code:
{validate field="FullName" criteria="notEmpty" append="errmsg" message=" Name A cannot be empty"}
...
{validate field="Size" criteria="isNumber" append="errmsg" message="Must be a Number"}


and we get in the array $errmsg
Code:

 {$errmsg}    Array (2)
                     0 => Name A cannot be empty
                     1 => Must be Number


It would be perfect to get not only numeric indexes (0,1,...) but also the named index from the validate fileldname. Having
Code:

 {$errmsg}    Array (2)
                     0 => Name A cannot be empty
                     FullName => Name A cannot be empty
                     1 => Must be Number
                     Size => Must be Number

Will be superb for error reporting

Regards
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7365
Location: Lincoln Nebraska, USA

PostPosted: Wed Jul 28, 2004 2:27 pm    Post subject: Reply with quote

It should probably be one or the other, and an associative array vs. an indexed array looks more useful, I'll get that changed in CVS. Thanks!
Back to top
View user's profile Send private message Visit poster's website
Isidor128
Smarty Regular


Joined: 27 Jul 2004
Posts: 35
Location: France

PostPosted: Wed Jul 28, 2004 2:48 pm    Post subject: Reply with quote

Great !!! Thx !

By the way I've some trouble with the syntax for multi row (1 form per row)
as described here
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=3100

if it's possible for you to have a look



I'm also experiencing issues with sessions, so even if there is no error,
SmartyValidate::is_valid($_POST) returns an error
The workarround wil be using the append option then verify if the array where append is done is empty or not.

This point is closed with the latest CVS version

regards
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    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