
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Any
|
|
Issue Links:
|
Duplicate
|
|
This issue duplicates:
|
|
TAPESTRY-678
LinkSubmit does not work correctly when the browser's back button is used and the form resubmitted normally
|
|
|
|
|
|
|
|
| Resolution Date: |
29/Mar/06 12:56 AM
|
|
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.
|
|
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. |
Show » |
|
// one hidden field per form:
String formHiddenFieldAttributeName = ATTRIBUTE_FUNCTION_NAME + formName;
if (cycle.getAttribute(formHiddenFieldAttributeName) == null)
{
+++ body.addInitializationScript("document." + formName + "._linkSubmit.value = null;");
writer.beginEmpty("input");
writer.attribute("type", "hidden");
writer.attribute("name", "_linkSubmit");
cycle.setAttribute(formHiddenFieldAttributeName, this);
}