velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Int64 <vineetbin...@gmail.com>
Subject RE: Velocity Variables are accepted in JavaScript Array??
Date Wed, 10 Jun 2009 14:37:14 GMT

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@gmail.com] 
> Sent: Wednesday, June 10, 2009 2:05 AM
> To: user@velocity.apache.org
> 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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Velocity-Variables-are-accepted-in-JavaScript-Array---tp23956244p23963673.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


Mime
View raw message