 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
louisJ Smarty n00b
Joined: 23 Jun 2012 Posts: 3
|
Posted: Sat Jun 23, 2012 8:30 pm Post subject: return javascript function value to smarty |
|
|
Hi
in my tpl file I would like to get the value corresponding to the radio button that is checked by the user, so I use a function called getCheckedValue defined the associated .js file, and I would like to use the returned value in smarty (product.tpl).
This doesn't work:
| Code: | | {assign var='chosenSize' value=getCheckedValue(document.forms['buy_block_form'].elements['group_1'])} |
How to pass a javascript variable to smarty?
thanks |
|
| Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7045 Location: Lincoln Nebraska, USA
|
Posted: Sat Jun 23, 2012 9:07 pm Post subject: |
|
|
| by the time the javascript (client-side) is executing, the smarty template (server-side) is out of the picture. so, not sure what you mean by passing a javascript value to smarty. when in the browser, view the HTML source. you will see no smarty tags, etc. Those where already executed server-side, and javascript knows nothing about smarty tags, vars, etc. |
|
| Back to top |
|
louisJ Smarty n00b
Joined: 23 Jun 2012 Posts: 3
|
Posted: Sun Jun 24, 2012 5:08 pm Post subject: |
|
|
ok I understand now, thanks.
Is there another way to accomplish what I need then? |
|
| 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
|