Well when you say "auto suggest", I have no idea what IDE you are using or what it does or does not support.
The key question is, does the suggestions.push(element); show up in the rendered page when you view the source?
-----Original Message-----
From: Int64 [mailto:
vineetbindal@...]
Sent: Wednesday, June 10, 2009 10:37 AM
To:
user@...
Subject: RE: Velocity Variables are accepted in JavaScript Array??
Hi I am sure that the list is not empty,
Becouse at the same time i am displaying the values from the list in a table to make sure that its not empty, that what i am confused about . allthough its displaying the values if i hardcode them and list is displaying values in the table. why suggestions.push(...) isnt accepting and displaing them in auto suggest???
Matt Brown-20 wrote:
>
> Are you sure that $allShowList is a non-empty list?
>
> Let's say the list has five items - then your foreach loop is
> effectively generating the following javascript:
>
> suggestions.push(...);
> suggestions.push(...);
> suggestions.push(...);
> suggestions.push(...);
> suggestions.push(...);
>
> Where "..." is the elements of the list.
>
> The fact that it works in your latter case (when you explicitly give a
> value to the variable) and not in the former (which because it is a
> foreach loop, relies on $allShowList to NOT be empty) suggests that
> you have issues with the list itself.
>
> What does the rendered HTML/Javascript show?
>
> I think you might be confused on what Velocity does (generates the
> HTML or whatever other files, at request-time) and where Javascript
> comes into play (once a user's browser 'runs' the page).
>
> -----Original Message-----
> From: Int64 [mailto:
vineetbindal@...]
> Sent: Wednesday, June 10, 2009 2:05 AM
> To:
user@...
> 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-Ar> ray---tp23956244p23956244.html Sent from the Velocity - User mailing
> list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@...
> For additional commands, e-mail:
user-help@...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
user-unsubscribe@...
> For additional commands, e-mail:
user-help@...
>
>
>
--
View this message in context:
http://www.nabble.com/Velocity-Variables-are-accepted-in-JavaScript-Array---tp23956244p23963673.htmlSent from the Velocity - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail:
user-unsubscribe@...
For additional commands, e-mail:
user-help@...
---------------------------------------------------------------------
To unsubscribe, e-mail:
user-unsubscribe@...
For additional commands, e-mail:
user-help@...