velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve O'Hara" <soh...@pivotal-solutions.co.uk>
Subject RE: Help me - how to pass retreived database values to Javascript
Date Thu, 23 Jun 2005 15:33:44 GMT
I'm guessing that you're trying to do something like this;

<script>
var myarray=[
#foreach ($item in $list)
'$item',
#end
]
</script>


This creates a javascript array (the last element is empty, but you get the
idea).

Steve




-----Original Message-----
From:
velocity-user-return-16262-sohara=pivotal-solutions.co.uk@jakarta.apache
.org
[mailto:velocity-user-return-16262-sohara=pivotal-solutions.co.uk@jakart
a.apache.org]On Behalf Of Barbara Baughman
Sent: 23 June 2005 16:05
To: Velocity Users List
Cc: velocity-user-help@jakarta.apache.org
Subject: Re: Help me - how to pass retreived database values to
Javascript


Writing Javascript with Velocity can be a little tricky, but just
remember that you use Velocity to set the values for constant fields
acted on by the Javascript function.

Do not write a Javascript function that tries to manipulate a Velocity
context object at runtime, because the Velocity context is not
available once the request leaves the server.  Javascript is run by
the client browser, which has no access to Velocity.

Barbara Baughman
X2157

On Thu, 23 Jun 2005, Veerappan Sridhar wrote:

> Hi,
>  Pls help how i can get the database values in javascript.
> I got list of values retrieved from backend and stored in arraylist
> like
> $alroles,
>  so now i can pass these values to javascript and access.
> Scenario:
> i have n number of text box,the text box(i) contains some values that
> values should be checked with the backend values for that i need a
> function to pass and compare in javascript.
>
> So pls help me
>
> Thanks
> Sridhar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

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






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


Mime
View raw message