开发者

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜