Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-597 Submit (and similar) should have easy ways of cancelling or refreshing a form
  3. TAPESTRY-840

Using Submit component as a cancel button causes listener to be called twice in Internet Explorer 6

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0
    • 4.1
    • Framework
    • None
    • Tapestry 4.0 final
      Internet Explorer 6

    Description

      The recommended way to build a cancel button on a form is to use the Submit component with javascript like onclick="javascript:this.form.events.cancel();". In Internet Explorer 6, this causes the cancel listener to get called twice and occasionally the two calls crash into each other and cause an exception. This problem does not exist with Firefox 1.5. Here is a simple example that demonstrates the behavior:

      <form jwcid="@Form" cancel="listener:cancel">
      <submit jwcid="@Submit" value="Cancel" onclick="javascript:this.form.events.cancel();"/>
      </form>

      public void cancel(IRequestCycle cycle)
      {
      System.out.println("cancel called");
      }

      Output after clicking the cancel button in IE 6:
      cancel called
      cancel called
      (and sometimes an exception and stack trace)

      The workaround is to use the Button component instead with the same javascript call. "cancel called" is only printed once in that case for Firefox and Internet Explorer and there are no exceptions.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dotteben Ben Dotte
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: