preventdefault

This commit is contained in:
James Campos 2011-09-03 12:56:56 -07:00
parent 8a5bbe2b54
commit 4de10a54d2
2 changed files with 4 additions and 1 deletions

View File

@ -1448,6 +1448,7 @@
if (!($('textarea', QR.qr).value || $('[type=file]', QR.qr).files.length)) {
if (e) {
alert('Error: No text entered.');
e.preventDefault();
}
return;
}

View File

@ -1134,7 +1134,9 @@ QR =
submit: (e) ->
#XXX e is undefined if method is called explicitly, eg, from auto posting
unless $('textarea', QR.qr).value or $('[type=file]', QR.qr).files.length
alert 'Error: No text entered.' if e #only alert if explicitly submitting
if e
alert 'Error: No text entered.'
e.preventDefault()
return
{qr} = QR
$('.error', qr).textContent = ''