|
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 |
pascalVG Smarty n00b
Joined: 03 Mar 2013 Posts: 2
|
Posted: Sat Jan 25, 2014 8:37 am Post subject: calling function of smarty variable in onclick of button |
|
|
Hi there,
I have a smarty variable $customer assigned in a controller file.
What I try is to call a function of this variable:
$customer->myFunction(language_id, password);
And want to do this from within or through the onclick of a button in my tpl file.
something like:
<input type="text" name=password" id="password" title="password" size="10" maxlength="10" />
<input type="button" name="my_button" id="my_button" value="Go" onclick="{$customer->myFunction($language_id, $('password').val())};" />
The page renders, but no button...
Any idea how to make this work???
thanks |
|
Back to top |
|
gyopee Smarty Rookie
Joined: 27 Jan 2014 Posts: 14
|
Posted: Mon Jan 27, 2014 11:21 am Post subject: |
|
|
Smarty template codes are executed before the client sees anything from your template.
So that, you cannot set a Smarty function to listen to a user action (the Smarty function is already evaluated when the user performs his/her action).
You must use JavaScript to achieve your goal. |
|
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
|