Reputation: 1362
I have a problem with Struts. The flow is like this:
null
because it is disabled. The problem is that the field still holds the value from the first submit. Any idea how should this be solved? I'm using Struts 1.
Upvotes: 2
Views: 911
Reputation: 24590
You probably have a session scoped form bean that retains the values between requests. When you submit new data, the form bean gets it's values updated from the fields inside the request (a data bind with the request parameters).
But there is a problem with disabled fields and checkboxes. Disabled fields, just like unchecked checkboxes, are not sent on the request when you submit the form. When the request arrives the field is not present in the request (because it's disabled) and Struts doesn't do a bind on it so it retains whatever value it previously had.
There are two ways to fix this:
Upvotes: 3