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

SmartyValidate does not accept template variables

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


Joined: 17 Sep 2008
Posts: 2

PostPosted: Wed Sep 17, 2008 11:16 am    Post subject: SmartyValidate does not accept template variables Reply with quote

Hi,

I am using the latest version of SmartyValidate-2.9. I used the following line in my template

{validate id="cname" message=$err_msg_required}

validate function doesnt return anything. If I hard code the message to a string then that string is printed correctly. If I print {$err_msg_required} the variable is printed correctly. Does SmartyValidate accept template variables as attribute values?


Thanks
Avneesh
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Sep 17, 2008 1:44 pm    Post subject: Reply with quote

It should , but make sure you reset SmartyValidate if your message changes. It stores the value in the session the first time the page is displayed.
Back to top
View user's profile Send private message Visit poster's website
avneeshjain
Smarty n00b


Joined: 17 Sep 2008
Posts: 2

PostPosted: Wed Sep 17, 2008 3:02 pm    Post subject: Reply with quote

Hi Monte,

That explains it - when the page renders for the the first time the template variable is not set. But my usecase is such that the message is constructed dynamically at the time of form submission. Any workaround that SmartyValidate does not use the message value from the session.

Thanks
Avneesh
Back to top
View user's profile Send private message
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