You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Eric Hodges <EH...@USDataworks.com> on 2004/04/01 16:29:45 UTC

RE: Question about logic:iterator, indexId and hidden fields

Thanks for the suggestion, but that doesn't work either.  The
<nested:submit> tag isn't replaced with an <input> tag when I use the syntax
you suggest.  I've tried many variations on these syntaxes.  If the JSP
expression get's parsed, the struts tags aren't understood.  If the struts
tags are understood the JSP expression isn't parsed.

Any other ideas?  Surely this is a common usage pattern.

-----Original Message-----
From: Martin Cooper [mailto:martinc@apache.org]
Sent: Wednesday, March 31, 2004 10:46 AM
To: user@struts.apache.org
Subject: Re: Question about logic:iterator, indexId and hidden fields



"Eric Hodges" <EH...@USDataworks.com> wrote in message
news:26439701CF1FE441B8EC1A2ADC7E87EE17843A@neptune.usdataworks.com...
> I have a form with a list of elements on it.  Each element has an "Edit"
> button associated with it.  When the user clicks the Edit button for a
> specific element, I want to send back the value of indexId in a hidden
field
> on the form.  I can't figure out a clean way to do this.  The
documentation
> says "indexId" will create a bean, but it really creates an Integer (which
> isn't a JavaBean).  I've tried passing my indexId to a Javascript function
> that sets the form's hidden field sort of like this:
>
> <nested:submit propert="edit" value="Edit"
> onclick="setEditIndex(<%=index%>)"/>
>
> but the <nested:submit> tag is evaluated before the <%=index%> tag

The problem is that you have illegal JSP syntax for the 'onclick' attribute.
The attribute value must be a string literal or a scripting expression. You
cannot mix the two. Try this instead:

  onclick='<%= "setEditIndex(" + index + ")" %>'

--
Martin Cooper


>
>
> Right now I've got some ugly JSP code that outputs the submit element that
> calls the Javascript function that sets the hidden field.  There must be a
> simpler way.  Any ideas?




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