I am not good in html or JavaScript and I have been trying alot to automatically call the JavaScript function from html drop down. My requirement is to hide the html drop down and hard code the value of drop down and automatically call the function which will query the database on the basis of this hard coded value. Those other retrieved values from db will be used in UI. JavaScript function is :
Behaviour.register({
'#retailerSelect': function(select) {
select.onchange = function() {
if (getValue(select) == ""){
setValue('query(branch)', "");
setValue('query(store)', "");
setValue('query(terminalId)', "");
}
this.form.submit();
}
},
HTML drop down is :
<td width="33%" align="center" >
<payo:layout columns="1">
<payo:cell nowrap="nowrap" align="center">
<html:select styleId="retailerSelect" style="margin:2px" property="query(retailer)">
<html:option value="1"><bean:message key="tms.dropdown.select.retailer"/></html:option>
<c:forEach var="retailer" items="${retailers}">
<html:option value="${retailer.id}">${retailer.retailerName}</html:option>
</c:forEach>
</html:select>
</payo:cell>
</payo:layout>
</td>
I need the value of drop down as 1, which will automatically call this onchange function to query the db.
please help,thanks in advance.