Skip to content

WICKET-6921 Avoid updating hidden forms#478

Merged
martin-g merged 1 commit into
apache:masterfrom
mat128:master
Sep 21, 2021
Merged

WICKET-6921 Avoid updating hidden forms#478
martin-g merged 1 commit into
apache:masterfrom
mat128:master

Conversation

@mat128
Copy link
Copy Markdown
Contributor

@mat128 mat128 commented Sep 21, 2021

Currently, MultipartFormComponentListener ensures form enctype is
correct on the client-side when visibility for multipart-enabling
components is toggled. It does so by visiting all form components,
detecting multipart-enabling components and emitting javascript code
to refresh the encoding type on the client-side.

There are a few issues solved by this commit:

  • The identified form component could be part of a hidden hierarchy.
    This prevents finding it in the DOM, and using it's form attribute
    to set the form enctype.

  • There could be more than one form with multipart-enabling components
    which would require an enctype refresh on the client-side.

This commit modifies MultipartFormComponentListener to find all forms,
ensure they are visible in the hierarchy, then visiting all form
components to find multipart-enabling. A single statement is emitted
per form.

Currently, MultipartFormComponentListener ensures form enctype is
correct on the client-side when visibility for multipart-enabling
components is toggled. It does so by visiting all form components,
detecting multipart-enabling components and emitting javascript code
to refresh the encoding type on the client-side.

There are a few issues solved by this commit:

- The identified form component could be part of a hidden hierarchy.
  This prevents finding it in the DOM, and using it's form attribute
  to set the form enctype.

- There could be more than one form with multipart-enabling components
  which would require an enctype refresh on the client-side.

This commit modifies MultipartFormComponentListener to find all forms,
ensure they are visible in the hierarchy, then visiting all form
components to find multipart-enabling. A single statement is emitted
per form.
@martin-g martin-g merged commit 9bfb779 into apache:master Sep 21, 2021
martin-g pushed a commit that referenced this pull request Sep 21, 2021
Currently, MultipartFormComponentListener ensures form enctype is
correct on the client-side when visibility for multipart-enabling
components is toggled. It does so by visiting all form components,
detecting multipart-enabling components and emitting javascript code
to refresh the encoding type on the client-side.

There are a few issues solved by this commit:

- The identified form component could be part of a hidden hierarchy.
  This prevents finding it in the DOM, and using it's form attribute
  to set the form enctype.

- There could be more than one form with multipart-enabling components
  which would require an enctype refresh on the client-side.

This commit modifies MultipartFormComponentListener to find all forms,
ensure they are visible in the hierarchy, then visiting all form
components to find multipart-enabling. A single statement is emitted
per form.

(cherry picked from commit 9bfb779)
@martin-g
Copy link
Copy Markdown
Member

Thank you, @mat128 !

@dashorst dashorst mentioned this pull request Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants