You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Foth, Oliver" <Ol...@gedas.de> on 2002/05/07 16:05:26 UTC

setTemp and getTemp

Hi everybody,

I've got the following challenge ;-)

I want to store something with setTemp. Works great if i do something like
$data.getUser().setTemp("dispo", "blabla"). I can use it in another template
with $data.getUser().getTemp("dispo"). So far so good! But instead of
"blabla" I need a variable which I get from an "onClick-event" with
javascript. 

onClick:
<BUTTON type="button" class="image_2" name="konf_$index"
onClick="konform('$dispogruppe.klasse')">

javascript:
function konform(dgkl)
{
   $data.getUser().setTemp("dispo", dgkl)
   ...
}

In the other *.vm file I try to use it as described above, but I only get
"java.lang.Object@2ed564" displayed.
Any ideas why the string is not displayed?


		Gruß,

		Oliver Foth
		----------------------------------------------------
		gedas deutschland GmbH
		Teilelogistik
		Johann-Siegmund-Schuckert-Str. 2a
		D-34225 Baunatal
		Telefon/phone	+49-561-49995-34
		Telefax/telefax	+49-561-49995-52
		Mailto: Oliver.Foth@gedas.de
		http://www.gedas.com
		----------------------------------------------------



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: setTemp and getTemp

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 5/7/02 10:05 AM, "Foth, Oliver" <Ol...@gedas.de> wrote:

> Hi everybody,
> 
> I've got the following challenge ;-)
> 
> I want to store something with setTemp. Works great if i do something like
> $data.getUser().setTemp("dispo", "blabla"). I can use it in another template
> with $data.getUser().getTemp("dispo"). So far so good! But instead of
> "blabla" I need a variable which I get from an "onClick-event" with
> javascript. 
> 
> onClick:
> <BUTTON type="button" class="image_2" name="konf_$index"
> onClick="konform('$dispogruppe.klasse')">
> 
> javascript:
> function konform(dgkl)
> {
>  $data.getUser().setTemp("dispo", dgkl)
>  ...
> }

Are you expecting the method to be called when the konform() function is
called?

That won't work - the javacscript is run on the client side, and the
setTemp() has already been called on the server side.


-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: setTemp and getTemp

Posted by Denis <ji...@respublica.fr>.
Oliver:

The Velocity commands are executed when the template is read. 
Velocity has nothing to do with Javascript, the code won't be 
executed any time konform is called.

You'd better stick with Javascript for this specific problem. This 
looks more like programming than templating.

Cheers,
-- Denis.

On Tuesday, May 7, 2002, at 03:05  pm, Foth, Oliver wrote:

> Hi everybody,
>
> I've got the following challenge ;-)
>
> I want to store something with setTemp. Works great if i do 
> something like
> $data.getUser().setTemp("dispo", "blabla"). I can use it in 
> another template
> with $data.getUser().getTemp("dispo"). So far so good! But instead of
> "blabla" I need a variable which I get from an "onClick-event" with
> javascript.
>
> onClick:
> <BUTTON type="button" class="image_2" name="konf_$index"
> onClick="konform('$dispogruppe.klasse')">
>
> javascript:
> function konform(dgkl)
> {
>    $data.getUser().setTemp("dispo", dgkl)
>    ...
> }
>
> In the other *.vm file I try to use it as described above, but I 
> only get
> "java.lang.Object@2ed564" displayed.
> Any ideas why the string is not displayed?
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>