I have a
JSP Page which accepts 4 fields. First field is populated by querying database as "Select Distinct field1 from db.table". After the user selects first field, onchange event causes field2 to be populated by querying the browser as "Select Distinct field2 from db.table where field1='"+value+"' ".
Same happens with 3rd and 4th fields. Now, when user submits the form, all fields get reset. I want the JSP page to show user selected values in all 4 fields.
If list in each dropdown is static (not dependant on other fields), then it works by using selected attribute. But this dependancy of each field on previous one is making it difficult.
Below code shows the user selected value after form submission for field1:
But for subsequent fields, onChange() event doesn't work, because we are not changing anything in field1.
I tried onLoad() to execute Javascript functions, but that doesn't seem to work.
How can we solve this???