I have an HTML form with three fields:
- Status
- Department, and
- Delivery Method
I want to display or hide the fields, depending upon whether the user’s browser supports JavaScript.
I’m also trying to set one field based upon the value of the other. If status is set to DE, then I want to set the value of delivery method to DE as well.
How would I go about implementing this functionality?
Aren’t fields you are using created using html tag? I’m not sure how you can use JAVA to disable them but you can surely use a simple javascript statement.
Say the status field has the id as ‘fStatus’.
Then you can simply do the following:
Now to execute to execute a function when status changes you will need to modify the html a bit. Like this:
and to execute the same function when the page load, modify body as such:
The appropriate javascript function would be: