Fix paper ID field
Change-Id: Ic6dcbfc2d88d37ae946a23bba783fdfbaf638332
diff --git a/static/main.js b/static/main.js
index e2b029c..e83a584 100644
--- a/static/main.js
+++ b/static/main.js
@@ -45,16 +45,15 @@
var paper_id = $("#paper_id");
if ($('#author').is(":checked")) {
paper_id.removeAttr('disabled');
- paper_id.attr('placeholder', '0');
paper_id.attr('pattern', '\\d{1,4}');
paper_id.attr('required', 'required');
- //if (paper_id.attr('oldval').match(/^\\d{4}$/)) {
- // paper_id.val(paper_id.attr('oldval'));
- //}
+ val = paper_id.val();
+ if (!x.match(/^\d{1,4}$/)) {
+ paper_id.val('');
+ }
} else {
- paper_id.attr('oldval', paper_id.val());
- paper_id.val('');
paper_id.attr('disabled', 'disabled');
+ paper_id.val('');
paper_id.removeAttr('placeholder');
paper_id.removeAttr('pattern');
paper_id.removeAttr('required');