fixed web2py.js for trapped non-self-submitting forms, thanks Vinicius
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -252,17 +252,28 @@
|
|||||||
/* traps any LOADed form */
|
/* traps any LOADed form */
|
||||||
$('#' + target + ' form').each(function (i) {
|
$('#' + target + ' form').each(function (i) {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
form.attr('data-w2p_target', target);
|
if(form.hasClass('no_trap')) {
|
||||||
if(!form.hasClass('no_trap')) {
|
return;
|
||||||
/* 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();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
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) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
|
|||||||
@@ -252,17 +252,28 @@
|
|||||||
/* traps any LOADed form */
|
/* traps any LOADed form */
|
||||||
$('#' + target + ' form').each(function (i) {
|
$('#' + target + ' form').each(function (i) {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
form.attr('data-w2p_target', target);
|
if(form.hasClass('no_trap')) {
|
||||||
if(!form.hasClass('no_trap')) {
|
return;
|
||||||
/* 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();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
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) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
|
|||||||
@@ -252,17 +252,28 @@
|
|||||||
/* traps any LOADed form */
|
/* traps any LOADed form */
|
||||||
$('#' + target + ' form').each(function (i) {
|
$('#' + target + ' form').each(function (i) {
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
form.attr('data-w2p_target', target);
|
if(form.hasClass('no_trap')) {
|
||||||
if(!form.hasClass('no_trap')) {
|
return;
|
||||||
/* 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();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
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) {
|
ajax_page: function (method, action, data, target, element) {
|
||||||
/* element is a new parameter, but should be put be put in front */
|
/* element is a new parameter, but should be put be put in front */
|
||||||
|
|||||||
Reference in New Issue
Block a user