wood burning stoves 2.0*
The moose likes Struts and the fly likes onchange with parameter on html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "onchange with parameter on html:select" Watch "onchange with parameter on html:select" New topic
Author

onchange with parameter on html:select

aishwarya lakshmi
Greenhorn

Joined: Nov 18, 2008
Posts: 20
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

Joined: Jul 10, 2008
Posts: 365
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.


Thanks,
Shailesh
aishwarya lakshmi
Greenhorn

Joined: Nov 18, 2008
Posts: 20
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.
 
subject: onchange with parameter on html:select
 
Similar Threads
html:option not selected
Tooltip on html:select
enable/disable drop down
Drop down without scrollbar
How to make <html:select dynamic