qr.autoPost

This commit is contained in:
James Campos 2011-08-23 20:57:18 -07:00
parent 3a577acf86
commit 17c594e19a
2 changed files with 11 additions and 5 deletions

View File

@ -1220,9 +1220,7 @@
submit.disabled = false; submit.disabled = false;
submit.value = 'Submit'; submit.value = 'Submit';
} }
if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) { return qr.autoPost();
return qr.submit.call($('form', qr.el));
}
} }
} }
}; };
@ -1258,6 +1256,11 @@
oldFile = $('#qr_form input[type=file]', qr.el); oldFile = $('#qr_form input[type=file]', qr.el);
return $.replace(oldFile, file); return $.replace(oldFile, file);
}, },
autoPost: function() {
if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) {
return qr.submit.call($('form', qr.el));
}
},
captchaNode: function(e) { captchaNode: function(e) {
var target; var target;
if (!qr.el) { if (!qr.el) {

View File

@ -960,8 +960,7 @@ cooldown =
for submit in submits for submit in submits
submit.disabled = false submit.disabled = false
submit.value = 'Submit' submit.value = 'Submit'
if qr.el and $('#auto', qr.el).checked and not qr.postInvalid() qr.autoPost()
qr.submit.call $ 'form', qr.el
qr = qr =
# TODO # TODO
@ -995,6 +994,10 @@ qr =
oldFile = $ '#qr_form input[type=file]', qr.el oldFile = $ '#qr_form input[type=file]', qr.el
$.replace oldFile, file $.replace oldFile, file
autoPost: ->
if qr.el and $('#auto', qr.el).checked and not qr.postInvalid()
qr.submit.call $ 'form', qr.el
captchaNode: (e) -> captchaNode: (e) ->
return unless qr.el return unless qr.el
{target} = e {target} = e