Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6926

Timer action on FileUploadField causes javascript error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 9.5.0
    • None
    • wicket-core
    • None
    • MacOS 11.6, multiple browsers

    Description

      Since 9.5.0, the combination of (Multi)FileUploadField and AbstractAjaxTimerBehavior will result in javascript errors, which will prevent other javascript events later on from completing (e.g. LazyLoadPanels that will be built on the same page in the future, which has been omitted in the quickstart).

      The bug occurs when a FileUploadField is present on a Page where an AbstractAjaxTimerBehavior is fired. The timer can be on a component not related to the FileUploadField or its Form (see quickstart for example regarding sibling component for the Form). During the timer the following error shows on the browser console:

      • Chrome (94.0.4606.81): Uncaught TypeError: Cannot read properties of null (reading 'form')
      • Safari (15.0): TypeError: null is not an object (evaluating 'Wicket.$('files5').form')

      Issue appears to be that the wicket-id for the component is not set in the resulting HTML-file, causing the evaluation of the statement above to generate a NullPointer. Unsure where the script call is coming from.

      Marking the FormComponent with .setOutputMarkupId(true) will temporarily solve the issue as the wicket-id will be added to the HTML, but this workaround is insufficient when the component is not present on the page (e.g. when the form is not yet visible in a dedicated save&edit component as demonstrated in the quickstart).

      Attachments

        1. bugUploadTimer quickstart.zip
          48 kB
          Erwin Starke

        Issue Links

          Activity

            People

              Unassigned Unassigned
              erwinator Erwin Starke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: