auto posting fix

This commit is contained in:
James Campos 2011-08-24 09:10:14 -07:00
parent e33bec4cfe
commit f5060431c2
2 changed files with 7 additions and 4 deletions

View File

@ -1257,7 +1257,7 @@
return $.replace(oldFile, file); return $.replace(oldFile, file);
}, },
autoPost: function() { autoPost: function() {
if (qr.el && $('#auto', qr.el).checked && !qr.postInvalid()) { if (qr.el && $('#auto', qr.el).checked) {
return qr.submit.call($('form', qr.el)); return qr.submit.call($('form', qr.el));
} }
}, },
@ -1435,7 +1435,9 @@
submit: function(e) { submit: function(e) {
var id, msg, op; var id, msg, op;
if (msg = qr.postInvalid()) { if (msg = qr.postInvalid()) {
e.preventDefault(); if (typeof e.preventDefault === "function") {
e.preventDefault();
}
alert(msg); alert(msg);
if (msg === 'You forgot to type in the verification.') { if (msg === 'You forgot to type in the verification.') {
$('#dummy', qr.el).focus(); $('#dummy', qr.el).focus();

View File

@ -996,7 +996,7 @@ qr =
$.replace oldFile, file $.replace oldFile, file
autoPost: -> autoPost: ->
if qr.el and $('#auto', qr.el).checked and not qr.postInvalid() if qr.el and $('#auto', qr.el).checked
qr.submit.call $ 'form', qr.el qr.submit.call $ 'form', qr.el
captchaNode: (e) -> captchaNode: (e) ->
@ -1173,8 +1173,9 @@ qr =
$.replace oldFile, newFile $.replace oldFile, newFile
submit: (e) -> submit: (e) ->
#XXX `e` won't exist if we're here from `qr.submit.call form`.
if msg = qr.postInvalid() if msg = qr.postInvalid()
e.preventDefault() e.preventDefault?()
alert msg alert msg
if msg is 'You forgot to type in the verification.' if msg is 'You forgot to type in the verification.'
$('#dummy', qr.el).focus() $('#dummy', qr.el).focus()