velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Florin Vancea" <fvan...@maxiq.ro>
Subject Re: Velocity Variables are accepted in JavaScript Array??
Date Thu, 11 Jun 2009 14:38:57 GMT
When you said

$show="someValue"

you was "talking" JavaScript, setting a variable named $show to be a string.

Take a look at the source that reaches the browser in each case and you'll
understand.

Velocity generates the page that gets sent to the browser. The browser
receives it and if it's legal JavaScript code, it executes it. That is what
bluejoe-2 was saying.

----- Original Message ----- 
From: "Int64" <vineetbindal@gmail.com>
To: <user@velocity.apache.org>
Sent: Thursday, June 11, 2009 4:24 PM
Subject: Re: Velocity Variables are accepted in JavaScript Array??


>
> 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
> >
> > ----- Original Message ----- 
> > From: "Int64" <vineetbindal@gmail.com>
> > To: <user@velocity.apache.org>
> > Sent: Wednesday, June 10, 2009 2:05 PM
> > Subject: Velocity Variables are accepted in JavaScript Array??
> >
> >
> >>
> >> I am developing an Ajax AutoComplete using javascript.
> >>
> >> I have an Array in which i am adding elements.
> >>
> >> var suggestions = new Array();
> >>
> >> #foreach($show in $allShowList)
> >>
> >> suggestions.push($show);
> >>
> >> #end
> >>
> >> when i do the above it does not add the variables to the list(it doesnt
> >> display then in autosuggest)
> >>
> >> but if i do
> >> $show="someValue"
> >> suggestions.push($show);
> >>
> >> Then it adds this thing
> >>
> >> Can some1 tell me why, is it a type compatibility issue?
> >> -- 
> >> View this message in context:
> >>
http://www.nabble.com/Velocity-Variables-are-accepted-in-JavaScript-Array---tp23956244p23956244.html
> >> Sent from the Velocity - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> >> For additional commands, e-mail: user-help@velocity.apache.org
> >>
> >>
> >> __________ Information from ESET NOD32 Antivirus, version of virus
> >> signature database 4101 (20090525) __________
> >>
> >> The message was checked by ESET NOD32 Antivirus.
> >>
> >> http://www.eset.com
> >>
> >>
> >>
> >
>
> -- 
> View this message in context:
http://www.nabble.com/Velocity-Variables-are-accepted-in-JavaScript-Array---tp23956244p23981251.html
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>



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


Mime
View raw message