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

[SmartyValidate] Problem with append ?

 
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
NoWhereMan
Smarty Rookie


Joined: 14 Feb 2006
Posts: 15

PostPosted: Sun Jan 28, 2007 10:54 am    Post subject: [SmartyValidate] Problem with append ? Reply with quote

Code:
{validate id="subject" message=$panelstrings.error.subject append="error"}
      {validate id="content" message=$panelstrings.error.content append="error"}
   
   
      {if $error}
      <ul class="errorlist">
         {foreach from=$error key=field item=msg}
         <li>{$field} : {$msg}</li>
         {/foreach}
      </ul>
      {/if}


this prints "0 : the error"

and no "Myfield : the error"

Am I missing something ? Sad

thank you


EDIT:

function.validate.php line 117 I've changed it into this:

Code:
   $smarty->append($params['append'], array($_sess['validators'][$_validator_key]['field']=>$_sess['validators'][$_validator_key]['message']), true);


hope it's correct
Back to top
View user's profile Send private message
TGKnIght
Smarty Junkie


Joined: 07 Sep 2005
Posts: 580
Location: Philadelphia, PA

PostPosted: Wed Jan 31, 2007 3:26 pm    Post subject: Reply with quote

Ah nice, great work =) I really needed those key names for my javascript to work.
_________________
Smarty site with one index.php controller file
Working with MySQL and Smarty
SmartyColumnSort
Custom Smarty Javascript Debug Template
Back to top
View user's profile Send private message Visit poster's website
brice
Smarty Rookie


Joined: 14 Apr 2006
Posts: 11

PostPosted: Thu Feb 15, 2007 12:17 am    Post subject: Reply with quote

I was able to accomplish similar behavior using the "key" attribute of {validate} -- e.g.

Code:

{validate key="username" field="username" message="invalid username" append="svErrorArray"}


No source code hack needed. It would be nice to see BETTER DOCUMENTATION of this in the README.. as I don't think enumerated keys are as useful as the fieldname/ID.

UPDATE: apparently the key fix was black magic. It is not working anymore... Embarassed

~ Brice
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