7 Replies Latest reply: Sep 3, 2010 2:07 AM by Daniel Winz RSS

JS onchange submit not rendered

Daniel Winz Newbie

Hello,

 

I want to execute some logic by selecting an element from a dropdown list. But the java onchange script (onchange="this.form.submit()") doesn't submit and the page doesn't reload. From the source of the webpage the submit statement is missing. Has anybody a clue why the script get not rendered to the webpage?

 

My JSP that contains the onchange="this.form.submit()":

 

<body>  
<f:view>  
    <h3><center>Welcome to Employee Home Page</center></h3>  
    <h:form>  
        <h3>Select an Employee Number from the drop down:</h3>  
        <br>  
        <br>  
        <h:selectOneMenu id="selEmpNo" onchange="this.form.submit()" valueChangeListener="#{employee.employeeReport}">  
            <f:selectItem itemLabel="select" />  
            <f:selectItems value="#{employee.empNoList}" id="emp" />  
        </h:selectOneMenu>  
    </h:form>  

 

The HTML source without onchange script:

 

<body>   

    <h3><center>Welcome to Employee Home Page</center></h3>  
    <br>  
    <br>  
<form id="j_id_jsp_1115269439_1" name="j_id_jsp_1115269439_1" method="post" action="/jsfsample/employee/EmployeeHome.jsp">  
<input type="hidden" name="j_id_jsp_1115269439_1" value="j_id_jsp_1115269439_1" />    

        <h3>Select an Employee Number from the drop down:</h3>  
        <br>  
        <br>  
        <select id="j_id_jsp_1115269439_1:selEmpNo" name="j_id_jsp_1115269439_1:selEmpNo" size="1">   <option value="" selected="selected">select</option>  
    <option value="1">1</option>  
    <option value="2">2</option>  
    <option value="3">3</option>  
</select>  

 

Thanks in advance,

Daniel