[
https://issues.apache.org/struts/browse/WW-2499?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Don Brown resolved WW-2499.
---------------------------
Resolution: Fixed
Fix Version/s: 2.1.2
Assignee: Don Brown
Done, thanks for the patch.
> CheckboxInterceptor sets disabled checkboxes to false even if checked
> ---------------------------------------------------------------------
>
> Key: WW-2499
> URL: https://issues.apache.org/struts/browse/WW-2499
> Project: Struts 2
> Issue Type: Bug
> Components: Core Interceptors
> Affects Versions: 2.0.9
> Reporter: Tim Stavenger
> Assignee: Don Brown
> Fix For: 2.1.2
>
>
> Disabled fields by W3 specifications are not "successful" in that they won't
> get posted on form submission
> (http://www.w3.org/TR/html4/interact/forms.html#h-17.12.1).
> The resulting request parameters for a <s:checkbox disabled="true" /> field
> look as if the checkbox were enabled and not checked (i.e., the '__checkbox_'
> parameter is present but not the parameter for the checkbox itself).
> Therefore the CheckboxInterceptor sets a new request parameter for the
> checkbox to false.
> However, if a checkbox is disabled this isn't at all what one would want --
> rather I would think the CheckboxInterceptor should not set a new request
> parameter if the checkbox in question is disabled.
> I think a straight forward solution would be to disable the '__checkbox_'
> hidden field if the checkbox itself is hidden, though I'm not finding
> anything in the W3 spec that says hidden fields can be disabled
> (http://www.w3schools.com/tags/tag_input.asp says they cannot, if you take
> W3Schools as an authoritative source). With the hidden field disabled, it too
> would not be posted on form submission and the problem would correct itself.
> However, the catch here is that the disabled attribute on an input field can
> be changed via script, so knowledge of the disabled fields needs to be at
> form submission rather than at page rendering. Perhaps the hidden field could
> still be used with some documentation in the tag reference/javadoc stating
> that if scripting is used to enable or disable a checkbox that the
> appropriate hidden field must be enabled or disabled as well?
> Another potential solution is to add another hidden field for checkboxes that
> denote the checkbox as disabled (at page rendering anyway). For instance a
> field starting with the name '__checkbox_disabled_'. Before setting a new
> request parameter for the checkbox, the CheckboxInterceptor could look for
> the appropriate '__checkbox_disabled_' field. If scripting were used to
> enable the disabled field, the script should also need to change the value of
> the '__checkbox_disabled_' field such that the CheckboxInterceptor knows what
> to do.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.