Commit 50cff8e1 authored by Jérome Perrin's avatar Jérome Perrin

Make the save button working after selecting an action and using "previous" from the browser.

submitForm function dynamically change the action of the default form when a select option is selected, so reset it to the default action with javascript before submitting from the save button.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14691 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 22f56651
...@@ -61,11 +61,21 @@ You should have received a copy of the GNU General Public License\n ...@@ -61,11 +61,21 @@ You should have received a copy of the GNU General Public License\n
along with this program; if not, write to the Free Software\n along with this program; if not, write to the Free Software\n
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
*/\n */\n
function submitAction(form,act) {\n \n
function submitAction(form, act) {\n
form.action = act;\n form.action = act;\n
form.submit();\n form.submit();\n
}\n }\n
\n \n
// This function will be called when the user click the save button. As \n
// submitAction function may have changed the action before, it\'s better to\n
// reset the form action to it\'s original behaviour. This is actually\n
// usefull when the user click the back button.\n
function clickSaveButton(act) {\n
document.forms[0].action = act;\n
}\n
\n
\n
// The first input element with an "autofocus" class will get the focus,\n // The first input element with an "autofocus" class will get the focus,\n
// else, nothing done\n // else, nothing done\n
function autoFocus() {\n function autoFocus() {\n
......
...@@ -100,7 +100,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n ...@@ -100,7 +100,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n
tal:condition="python: (not is_web_mode or editable_mode) and len(actions)">\n tal:condition="python: (not is_web_mode or editable_mode) and len(actions)">\n
<button tal:condition="python: not is_web_mode and form_action"\n <button tal:condition="python: not is_web_mode and form_action"\n
type="submit" class="save" title="Save"\n type="submit" class="save" title="Save"\n
tal:attributes="name python: \'%s:method\' % (form_action, )"\n tal:attributes="name string:${form_action}:method;\n
onClick string:javascript:clickSaveButton(\'${form_action}\');"\n
i18n:attributes="title" i18n:domain="ui">\n i18n:attributes="title" i18n:domain="ui">\n
<span class="image"></span>\n <span class="image"></span>\n
<span class="description" i18n:translate="" i18n:domain="ui">Save</span>\n <span class="description" i18n:translate="" i18n:domain="ui">Save</span>\n
......
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