[ 
https://issues.apache.org/jira/browse/WICKET-6921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17418105#comment-17418105
 ] 

ASF GitHub Bot commented on WICKET-6921:
----------------------------------------

mat128 opened a new pull request #478:
URL: https://github.com/apache/wicket/pull/478


   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@wicket.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> MultipartFormComponentListener breaks on hidden components
> ----------------------------------------------------------
>
>                 Key: WICKET-6921
>                 URL: https://issues.apache.org/jira/browse/WICKET-6921
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 9.5.0
>            Reporter: Mathieu Mitchell
>            Assignee: Martin Tzvetanov Grigorov
>            Priority: Minor
>         Attachments: WICKET-6914-demo.zip, WICKET-6921.patch
>
>
> MultipartFormComponentListener does not seem to handle hidden components, or 
> components included in an hidden container.
> Currently, javascript errors in browser console appear when rendering any 
> component while forms are included inside unrelated hidden containers.
> This problem first appeared in Wicket 9.5.0.
> {{Uncaught TypeError: Cannot read properties of null (reading 'form')}}
> This appears to be caused because the component cannot be found in the DOM.
> {{Wicket.$('fileUpload9').form.enctype='application/x-www-form-urlencoded'}}} 
> This unhandled error stops further evaluation of javascript statements.
> This regression appears to be caused by the MultipartFormComponentListener 
> that was recently added while fixing WICKET-6914.
> Generally, form components and forms can be included in an hidden container 
> without problem.
> Furthermore, the MultipartFormComponentListener stops after handling the 
> first component of a multipart form. A single page could container multiple 
> forms and the other forms would not have the right encoding-type set.
> Attached is the democase for WICKET-6914, edited to demonstrate the problems 
> caused by the regression.
> I also added a test case and modified the code to satisfy the new 
> requirements.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to