javascript server issue
Onchage of selection i am calling a开发者_开发百科 javascript to make a server call using struts1.2 but its not making a call.Please let me know where i am going wrong,below is the code
<html:form action="/populate">
<html:select property="tName" onchange="test()">">
<html:option value="">SELECT</html:option>
<html:options name="tList" />
</html:select>
</html:form>
and stuts-config has
<action path="/populate" name="tForm" type="com.testAction" validate="false" parameter="method" scope="request" >
<forward name="success" path="/failure.jsp" />
</action>
and javascript is
function test(){
var selObj = document.getElementById("tName");
var selIndex = selObj.selectedIndex;
if (selIndex != 0) {
document.form[0].selIndex.action="/populate.do?method=execute&testing="+selIndex;
document.form[0].submit();
}
}
document.forms — plural.
document.forms[0].action="..."; // (don't need "selIndex" in there)
精彩评论