You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Po Po <se...@yahoo.com> on 2006/12/12 10:21:45 UTC

how get index value at logic:iterate

Hello,

I've a collection and i iterate using logic:iterate,
inside the iterate, put a html:select.

<logic:iterate name="form" property="coll" id="idx"
indexId="indexId">
...
<html:select name="idx" property="grade"
onchange="onchangeGrade(${indexId});" >
</html:select>
...
</logic:iterate>


In the html:select, I add an javascript onchange
event. the event call onchangeGrade. 
I need the indexId is write as parameter in javascript
onchangeGrade.
But when I run, it's javascript error. When view the
html source see, the ${indexId} is not convert to a
number (just as string).

Expected: onchange="onchangeGrade(0);"
          onchange="onchangeGrade(1);"
          ... etc


Anyone can help?

Thanks,
Popo


 
____________________________________________________________________________________
Need a quick answer? Get one in minutes from people who know.
Ask your question on www.Answers.yahoo.com

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


Re: how get index value at logic:iterate

Posted by Po Po <se...@yahoo.com>.
Ok, it's working.

Thanks,
Popo

--- Nikhil Walvekar <wa...@gmail.com> wrote:

> try
> 
> onchange='<%= "onchangeGrade(" + indexId.intValue()
> + ");" %>'
> 
> 
> Regards,
> Nikhil
> 
> On 12/12/06, Po Po <se...@yahoo.com> wrote:
> >
> > Hello,
> >
> > I've a collection and i iterate using
> logic:iterate,
> > inside the iterate, put a html:select.
> >
> > <logic:iterate name="form" property="coll"
> id="idx"
> > indexId="indexId">
> > ...
> > <html:select name="idx" property="grade"
> > onchange="onchangeGrade(${indexId});" >
> > </html:select>
> > ...
> > </logic:iterate>
> >
> >
> > In the html:select, I add an javascript onchange
> > event. the event call onchangeGrade.
> > I need the indexId is write as parameter in
> javascript
> > onchangeGrade.
> > But when I run, it's javascript error. When view
> the
> > html source see, the ${indexId} is not convert to
> a
> > number (just as string).
> >
> > Expected: onchange="onchangeGrade(0);"
> >           onchange="onchangeGrade(1);"
> >           ... etc
> >
> >
> > Anyone can help?
> >
> > Thanks,
> > Popo
> >
> >
> >
> >
> >
>
____________________________________________________________________________________
> > Need a quick answer? Get one in minutes from
> people who know.
> > Ask your question on www.Answers.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
> 
> -- 
> Nikhil
> 



 
____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

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


Re: how get index value at logic:iterate

Posted by Nikhil Walvekar <wa...@gmail.com>.
try

onchange='<%= "onchangeGrade(" + indexId.intValue() + ");" %>'


Regards,
Nikhil

On 12/12/06, Po Po <se...@yahoo.com> wrote:
>
> Hello,
>
> I've a collection and i iterate using logic:iterate,
> inside the iterate, put a html:select.
>
> <logic:iterate name="form" property="coll" id="idx"
> indexId="indexId">
> ...
> <html:select name="idx" property="grade"
> onchange="onchangeGrade(${indexId});" >
> </html:select>
> ...
> </logic:iterate>
>
>
> In the html:select, I add an javascript onchange
> event. the event call onchangeGrade.
> I need the indexId is write as parameter in javascript
> onchangeGrade.
> But when I run, it's javascript error. When view the
> html source see, the ${indexId} is not convert to a
> number (just as string).
>
> Expected: onchange="onchangeGrade(0);"
>           onchange="onchangeGrade(1);"
>           ... etc
>
>
> Anyone can help?
>
> Thanks,
> Popo
>
>
>
>
> ____________________________________________________________________________________
> Need a quick answer? Get one in minutes from people who know.
> Ask your question on www.Answers.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Nikhil

Re: how get index value at logic:iterate

Posted by Antonio Petrelli <ap...@apache.org>.
Po Po ha scritto:
> But when I run, it's javascript error. When view the
> html source see, the ${indexId} is not convert to a
> number (just as string).
>   

Do you use a JSP 2.0 compliant app server, such as Tomcat 5.5?

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