0

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

2 Answers 2

1

document.forms — plural.

Sign up to request clarification or add additional context in comments.

Comments

0
document.forms[0].action="..."; // (don't need "selIndex" in there)

2 Comments

ya its fine,now i am getting /populate not available even though mapping is there in xml
You'll need a struts guy for that. :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.