|
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 |
mgm_03 Smarty Rookie
Joined: 07 Dec 2004 Posts: 23
|
Posted: Mon Dec 27, 2004 11:12 pm Post subject: SmartyValidate: assigning err msg to template variable |
|
|
I've implemented the SmartyValidate plugin and am trying to get the template to assign the error message for each form field to a variable. This way I can display the error message anywhere in the template.
Code: |
{validate field="name" criteria="notEmpty" assign="error" halt="yes" transform="trim" message="Please provide your name."}
<input type="text" name="name" size="30" value="{$name|escape}">
|
Elsewhere I have :
However, it's not working. Is there an order in which the assign should appear inside the validate tags {}? Is there a dependency on the .php file? Could not determine the answer from the doc. |
|
Back to top |
|
mgm_03 Smarty Rookie
Joined: 07 Dec 2004 Posts: 23
|
Posted: Mon Dec 27, 2004 11:19 pm Post subject: |
|
|
Now..I have this situation:
Submitting a blank form results in the first form field err message displayed (where I expect it to be). Then, putting a value in that form field and submitting should still return an error message since the second form field is still blank (all fields are required). However, there is no error message this time.
Not sure what I could've screwed up.
Code: |
<div class="contact">
Your Name<br />
{validate field="name" criteria="notEmpty" assign="error" halt="yes" transform="trim" message="Please enter your name."}
<input type="text" name="name" size="30" value="{$name|escape}">
</div>
<div class="contact">
{validate field="subject" criteria="notEmpty" assign="error" halt="yes" transform="trim" message="Please enter a subject"}
Subject<br />
<input type="text" name="subject" size="30" value="{$subject|escape}">
</div>
|
|
|
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
|