Looking at the generated javascript should reveal all. If in Velocity you say

#set($foo = "bar")
suggest.push("$foo")
suggest.push($foo)

will render as:

suggest.push("bar")
suggest.push(bar)

When the javascript runs the second line is referencing a variable 'bar' which is not defined, and will cause a javascript error.

If you have the error console running in your browser, you should see javascript errors to this effect.

On Jun 11, 2009, at 6:24 , Int64 wrote:

Your suggestion for suggestions.push("$show"); really worked,

But can you please explain why suggestions.push($show);was not working and
it was not working with my values from database(it was working for
hard-coded values). and why your suggestion worked??

bluejoe-2 wrote:

if $show is a string, you can try
suggestions.push("$show");

VTL renders on server-side
while javascript executes on browser

yours,
bluejoe


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org
For additional commands, e-mail: user-h...@velocity.apache.org

Reply via email to