Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-339

LinkSubmit can cause browser back button problems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.0.5
    • 3.0.5
    • None
    • None
    • Any

    Description

      If LinkSubmit is mixed with other submit components in the same form, erroneous submits can occur from pages accessed via the browser back button. This happens because LinkSubmit's hidden variable is never reset.

      Suggested fix (line marked +++) in LinkSubmit.java, renderComponent method:

      // make sure the submit function is on the page (once)
      if (cycle.getAttribute(ATTRIBUTE_FUNCTION_NAME) == null)
      {
      +++ body.addInitializationScript("document." + formName + "._linkSubmit.value = null;");
      body.addBodyScript(
      "function submitLink(form, elementId)

      { form._linkSubmit.value = elementId; if (form.onsubmit == null || form.onsubmit()) form.submit(); }

      ");
      cycle.setAttribute(ATTRIBUTE_FUNCTION_NAME, this);
      }

      It would be great if the corrected LinkSubmit submission mechanism detail was factored out into a separate class, so that other submit components could be built using it. For example, Glen Stampoultzis's ButtonSubmit component.

      Attachments

        Issue Links

          Activity

            People

              jkuhnert Jesse Kuhnert
              sicklittlemonkey Nick Westgate
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: