Commit e4858d97 authored by Jérome Perrin's avatar Jérome Perrin

Prevent submitting a dialog twice

Code from Sven
parent 9a04f8c4
...@@ -11205,6 +11205,9 @@ msgstr "Passe l'écriture au brouillard validé." ...@@ -11205,6 +11205,9 @@ msgstr "Passe l'écriture au brouillard validé."
msgid "This action will post the transaction to the General Ledger. It can be journalized again thanks to the restart action" msgid "This action will post the transaction to the General Ledger. It can be journalized again thanks to the restart action"
msgstr "Passe l'écriture au brouillard validé." msgstr "Passe l'écriture au brouillard validé."
msgid "This dialog has already been submitted. Do you want to submit again ?"
msgstr "Le dialogue a déjà été soumis. Voulez vous le soumettre à nouveau ?"
msgid "This document is not converted yet." msgid "This document is not converted yet."
msgstr "Ce document n'est pas encore converti" msgstr "Ce document n'est pas encore converti"
......
207 208
\ No newline at end of file \ No newline at end of file
...@@ -76,12 +76,15 @@ ...@@ -76,12 +76,15 @@
tal:content="python:here.Base_getFormViewDialogActionButtonTitle(form)">Do Action</span>\n tal:content="python:here.Base_getFormViewDialogActionButtonTitle(form)">Do Action</span>\n
</button>\n </button>\n
</div>\n </div>\n
<script type="text/javascript"\n
tal:define="message python:context.Base_translateString(\'This dialog has already been submitted. Do you want to submit again ?\').replace(\'\\\\\', \'\\\\\\\\\').replace(\'\\\'\', \'\\\\\\\'\')"\n
tal:content="structure string:installDoubleSubmitDialogPrevention(\'$message\');">\n
</script>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>
]]></unicode> </value> ]]></unicode> </value>
</item> </item>
......
...@@ -371,7 +371,23 @@ if (navigator.userAgent.toLowerCase().indexOf(\'firefox\') != -1)\n ...@@ -371,7 +371,23 @@ if (navigator.userAgent.toLowerCase().indexOf(\'firefox\') != -1)\n
$(document).ready(rewriteIndentedSelect);\n $(document).ready(rewriteIndentedSelect);\n
$(document).ready(resizeIFrameOnLoad);\n $(document).ready(resizeIFrameOnLoad);\n
$(document).ready(addOnChangeEventHandler);\n $(document).ready(addOnChangeEventHandler);\n
$(document).ready(indexAllCheckBoxesAtBTInstallationOnLoad); $(document).ready(indexAllCheckBoxesAtBTInstallationOnLoad);\n
\n
\n
\n
function installDoubleSubmitDialogPrevention(confirmation_message) {\n
/* Install an handler to prevent submitting a dialog twice. */\n
$(document).ready( function() {\n
$(".dialog_submit_button").on("click", function(e){\n
$(this).on("click.confirm", function(event) {\n
$(this).off(".confirm");\n
if (! confirm(confirmation_message) ) {\n
event.preventDefault();\n
}\n
});\n
});\n
});\n
}
]]></string> </value> ]]></string> </value>
</item> </item>
......
1105 1107
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment