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

Behavior (which performs a form post) not executed the second time if the form contains a required field (which failed the first time).

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: 1.5.6
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Tested with Tomcat 7 / Jetty 7.5, Firefox 12.0 / Chrome 18.0 (OS: Kubuntu 11.10)

      Description

      • Use case -
        Just to summarize the - real - use case: I have a button which makes the user confirming the form post - before it is being sent - through a dialog box. That means that the button that is displayed does not post the form by itself but delegates the action. To achieve this, an ajax-button (which has setDefaultFormProcessing set to false) opens the dialog box at its onSubmit event. The dialog has an AbstractDefaultAjaxBehavior which will be called on the onclick dialog-confirm-button's event (because it looks like a button but is not a Wicket one). The respond() method of this behavior then attaches a "submit()" javascript command (jQuery, but it can be replaced by a standard javascript here) to the AjaxRequestTarget, which is executed on client side and then the form is submitted over http (non-ajax, then).
      • Symptoms -
        According that the form also has a RequiredTextField (because it makes more sense to send a form that contains form-elements), there is an issue when the user starts by NOT entering a value before posting the form.
        In that case, the form will be sent (for the first time) and the validation will fail as expected. But after that, on successive calls, the form never triggers events anymore (for instance Form#onFormSubmitted()).
        Visually, the form seems to be sent (and the page is refreshed), but it's looks like the behavior script transmitted to the client is not executed (the page is immediately re-rendered after the "Invoking pre-call handler(s)..." step)

      Where it is weird, is that when the user begins by entering a value, send the form, remove the value, resend the form, set a value again, resend, etc. All is working. Just in the case where, at the very first try, no value is set, then the issue appears.

      • Quickstart -
        In the attached quickstart, the "confirm-button" described above has been replaced by a Label which will apply the same technic as describe above.

        Attachments

        1. quickstart.zip
          10 kB
          Sebastien Briquet

          Issue Links

            Activity

              People

              • Assignee:
                ivaynberg Igor Vaynberg
                Reporter:
                sebfz1 Sebastien Briquet
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: