• Post Reply Bookmark Topic Watch Topic
  • New Topic

onchange with parameter on html:select  RSS feed

 
aishwarya lakshmi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I need to make a java script call by onchange methos with parameter from Struts html:select statement. when i tries that its showing Illegal xml exception.


some thing like

<html:select property="selectedItem" onchange="javascript:doOnchange(<%=i%>)">
<htmlption value="Maria">Maria</htmlption>
<htmlption value="Klaus">Klaus</htmlption>
</html:select>


How to pass scriptlet from javascript method in html:select.

Thanks
Lakshmi
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi aishwarya,

It seems right.
we can give expression in onchange attribute of html:select tag.
Problem may be different.
Please post whole stack trace of exception.
 
aishwarya lakshmi
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your response

i archived it passing it in string

<%
String s = "javascript:doOnchange("+i+")";
%>


onchange = "<%= s %>"
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!