diff --git a/VERSION b/VERSION index 8547898d..59566188 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.03.22.45.08 +Version 2.7.4-stable+timestamp.2013.11.06.10.29.44 diff --git a/applications/admin/static/js/web2py.js b/applications/admin/static/js/web2py.js index 5311981e..d9cc0407 100644 --- a/applications/admin/static/js/web2py.js +++ b/applications/admin/static/js/web2py.js @@ -252,17 +252,28 @@ /* traps any LOADed form */ $('#' + target + ' form').each(function (i) { var form = $(this); - form.attr('data-w2p_target', target); - if(!form.hasClass('no_trap')) { - /* should be there by default */ - form.submit(function (e) { - web2py.disableElement(form.find(web2py.formInputClickSelector)); - web2py.hide_flash(); - web2py.ajax_page('post', action, form.serialize(), target, form); - e.preventDefault(); - }); + if(form.hasClass('no_trap')) { + return; } - }); + + form.attr('data-w2p_target', target); + var url; + + if(form.hasClass('trap_use_form_action')) { + /* submit using form own action, instead of component url */ + url = form.attr('action'); + } else { + /* should be there by default */ + url = action; + } + + form.submit(function (e) { + web2py.disableElement(form.find(web2py.formInputClickSelector)); + web2py.hide_flash(); + web2py.ajax_page('post', url, form.serialize(), target, form); + e.preventDefault(); + }); + }); }, ajax_page: function (method, action, data, target, element) { /* element is a new parameter, but should be put be put in front */ diff --git a/applications/examples/static/js/web2py.js b/applications/examples/static/js/web2py.js index 5311981e..d9cc0407 100644 --- a/applications/examples/static/js/web2py.js +++ b/applications/examples/static/js/web2py.js @@ -252,17 +252,28 @@ /* traps any LOADed form */ $('#' + target + ' form').each(function (i) { var form = $(this); - form.attr('data-w2p_target', target); - if(!form.hasClass('no_trap')) { - /* should be there by default */ - form.submit(function (e) { - web2py.disableElement(form.find(web2py.formInputClickSelector)); - web2py.hide_flash(); - web2py.ajax_page('post', action, form.serialize(), target, form); - e.preventDefault(); - }); + if(form.hasClass('no_trap')) { + return; } - }); + + form.attr('data-w2p_target', target); + var url; + + if(form.hasClass('trap_use_form_action')) { + /* submit using form own action, instead of component url */ + url = form.attr('action'); + } else { + /* should be there by default */ + url = action; + } + + form.submit(function (e) { + web2py.disableElement(form.find(web2py.formInputClickSelector)); + web2py.hide_flash(); + web2py.ajax_page('post', url, form.serialize(), target, form); + e.preventDefault(); + }); + }); }, ajax_page: function (method, action, data, target, element) { /* element is a new parameter, but should be put be put in front */ diff --git a/applications/welcome/static/js/web2py.js b/applications/welcome/static/js/web2py.js index 5311981e..d9cc0407 100644 --- a/applications/welcome/static/js/web2py.js +++ b/applications/welcome/static/js/web2py.js @@ -252,17 +252,28 @@ /* traps any LOADed form */ $('#' + target + ' form').each(function (i) { var form = $(this); - form.attr('data-w2p_target', target); - if(!form.hasClass('no_trap')) { - /* should be there by default */ - form.submit(function (e) { - web2py.disableElement(form.find(web2py.formInputClickSelector)); - web2py.hide_flash(); - web2py.ajax_page('post', action, form.serialize(), target, form); - e.preventDefault(); - }); + if(form.hasClass('no_trap')) { + return; } - }); + + form.attr('data-w2p_target', target); + var url; + + if(form.hasClass('trap_use_form_action')) { + /* submit using form own action, instead of component url */ + url = form.attr('action'); + } else { + /* should be there by default */ + url = action; + } + + form.submit(function (e) { + web2py.disableElement(form.find(web2py.formInputClickSelector)); + web2py.hide_flash(); + web2py.ajax_page('post', url, form.serialize(), target, form); + e.preventDefault(); + }); + }); }, ajax_page: function (method, action, data, target, element) { /* element is a new parameter, but should be put be put in front */