javascript server issue

Posted by sarah on Stack Overflow See other posts from Stack Overflow or by sarah
Published on 2010-04-01T05:27:24Z Indexed on 2010/04/01 5:33 UTC
Read the original article Hit count: 293

Filed under:

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();
    }
}

© Stack Overflow or respective owner

Related posts about java