[ 
https://issues.apache.org/jira/browse/WW-5696?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-5696:
------------------------------
    Component/s: Core Tags

> Remove deprecated JavaScript client-side validation
> ---------------------------------------------------
>
>                 Key: WW-5696
>                 URL: https://issues.apache.org/jira/browse/WW-5696
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Tags
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 8.0.0
>
>
> Removes what WW-5694 deprecated in 7.4.0. The successor is WW-5695, native 
> HTML5 constraint attributes in the {{html5}} theme.
> h2. Why it is more than one template
> The form tag's {{validate="true"}} attribute makes four separate edits to the 
> rendered form, and all four have to come out together:
> * {{xhtml/form-validate.ftl}} injects the {{validation.js}} script tag
> * the same template rewrites {{onsubmit}} to call the generated 
> {{validateForm_}} function
> * {{xhtml/form.ftl}} overwrites {{onreset}} with calls to 
> {{clearErrorMessages}} and {{clearErrorLabels}}
> * {{xhtml/form-close.ftl}} includes {{form-close-validate.ftl}}
> h2. Scope
> Delete:
> * {{core/src/main/resources/template/xhtml/form-close-validate.ftl}}
> * {{core/src/main/resources/template/xhtml/form-validate.ftl}}
> * {{core/src/main/resources/template/xhtml/validation.js}}
> * {{core/src/main/resources/template/css\_xhtml/validation.js}}
> Strip the {{validate}} branches from {{xhtml/form.ftl}} and 
> {{xhtml/form-close.ftl}}.
> Drop {{validate}}, {{performValidation}} and {{tagNames}} from {{Form}}, 
> together with {{Form.getValidators(String)}} and 
> {{Form.evaluateClientSideJsEnablement}}. Drop {{FormTag.setValidate}} and its 
> field, including the reset in {{FormTag.clearTagStateForTagPoolingServers}}. 
> Drop the {{tagNames}} append in {{UIBean.evaluateParams}}.
> Flip {{struts.ui.html5.constraints}} to default {{true}}.
> h2. Do not miss
> {{html5/form.ftl}} also reads {{attributes.validate}} in its {{onsubmit}} 
> guard and must be updated in the same change. It is easy to overlook because 
> the html5 theme never had the JavaScript validator itself.
> {{Dispatcher}} and {{ValidationInterceptor}} declare unrelated 
> {{setValidate}} methods. Leave them alone.
> h2. Tests
> Retire the {{Formtag-2.txt}}, {{Formtag-11.txt}}, {{Formtag-22.txt}} and 
> {{Formtag-24.txt}} golden files and the {{FormTagTest}} methods that verify 
> them.
> h2. Closes WW-2975 at the root
> {{tagNames}} disappears here. WW-2975 — client-side validation ignoring any 
> field not rendered by a Struts tag nested in the form — was a consequence of 
> that list existing, so removing it ends the problem rather than patching it. 
> WW-2975 is closed as superseded rather than fixed.
> h2. Migration
> Needs a prominent Migration Guide entry. Forms relying on {{validate="true"}} 
> lose client-side checking; server-side validation is unaffected, so this is a 
> UX regression rather than a correctness or security one, but users must be 
> told to move to the {{html5}} theme.
> Also note in the release notes that {{HtmlControlType}} gaining members in a 
> later release can make an exhaustive switch in a custom 
> {{HtmlConstraintProvider}} non-exhaustive.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to