struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ylva Degerfeldt" <ylva.degerfe...@gmail.com>
Subject Re: [S2] Problem with list of submit buttons
Date Fri, 29 Aug 2008 19:40:57 GMT
Thanks again!

About the value (Question 3) I just wasn't sure I could use OGNL when
writing JavaScript but Ok. I get it.

I also found this example:
http://www.developertutorials.com/tutorials/javascript/change-form-field-values-050522/page1.html

The only thing that's left to fix now (I think) is finding a way to
reference the form field correctly. I have Not found this in any
tutorial.
It seems like it should be something like:

xxxxx.NameOfForm.NameOfHiddenField.value = INPUTVAL

The part that I called "xxxxx" is the part that I don't understand.
Should it be the name of the JSP or what?

/Ylva

On Fri, Aug 29, 2008 at 8:54 PM, Dave Newton <newton.dave@yahoo.com> wrote:
> --- On Fri, 8/29/08, Ylva Degerfeldt wrote:
>> Basically, I need to know 3 things:
>> 1. Does the code have to be in a JS method or can it be
>> "right under onclick"?
>
> Doesn't matter, but since you have to both set the form field and submit the form it's
likely to be cleaner to put it in a JavaScript method. Matter of preference.
>
>> 2. How do I set the reference to the hidden field in JS?
>
> Any JavaScript/DOM tutorial/documentation will explain that.
>
>> 3. How do I set the value of (1) to the value of #state.index
>> in JS? (Do I keep the '#', do I need %{ } or what?)
>
> Not sure what you mean here; you'd use standard OGNL syntax:
>
> <s:submit ... onclick="return foo(%{#state.index})" ... />
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


Mime
View raw message