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

using a smarty variable as an argument for a javascript func

 
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 -> General
View previous topic :: View next topic  
Author Message
mto
Smarty n00b


Joined: 22 Apr 2003
Posts: 1

PostPosted: Tue Apr 22, 2003 12:13 pm    Post subject: using a smarty variable as an argument for a javascript func Reply with quote

I'd like to use a smarty variable as an argument for a javascript function.
I wrote something like that but it don't works :
<input type='text' size='10' value='{$smarty.now|date_format:"%d/%m/%Y"}' name='txtText'>
<input type='button' value='OK' onClick='fctTest(txtText.value,{literal}{$dateWriter}{/literal})'>

here is the message :
missing : after property id
fctTest(txtText.value,{$dateWriter})
What is wrong ?
Back to top
View user's profile Send private message
dthought
Smarty Regular


Joined: 21 Apr 2003
Posts: 55
Location: Melbourne, Australia

PostPosted: Tue Apr 22, 2003 12:45 pm    Post subject: Reply with quote

Wrong way around... you use {literal} when you have JavaScript that uses curly braces (so Smarty doesn't try to pick them up as Smarty tags).

Remove the literal tags and you should be fine.
Back to top
View user's profile Send private message Visit poster's website
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 -> General 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