Add $CONFERENCE_REGISTRATION flag and for fields
Change-Id: I296f5350fb4a5f34c39a15bcbabc511f735f2fc6
diff --git a/static/main.js b/static/main.js
index e381ac6..a07eb52 100644
--- a/static/main.js
+++ b/static/main.js
@@ -2,6 +2,7 @@
(function () {
'use strict';
window.addEventListener('load', function () {
+ update_total_costs();
// Fetch all the forms we want to apply custom Bootstrap validation styles to
var forms = document.getElementsByClassName('needs-validation');
// Loop over them and prevent submission
@@ -17,6 +18,37 @@
}, false);
})();
+function update_total_costs() {
+ var costs = 0;
+
+
+ if ($('#participate').is(":checked")) {
+ costs += parseInt($("#conference_fee").text(),10);
+ if ($('#student').is(":checked")) {
+ costs -= parseInt($("#student_discount").text(), 10);
+ }
+ if ($('#conference_dinner').is(":checked")) {
+ costs += parseInt($("#conference_dinner_price").text(), 10);
+ }
+ }
+ $("#total_costs").val(costs.toLocaleString('en-US', {minimumFractionDigits: 2, maximumFractionDigits: 2}));
+}
+
+function update_paper_id_field() {
+ var paper_id = $("#paper_id");
+ if ($('#author').is(":checked")) {
+ paper_id.removeAttr('disabled');
+ paper_id.attr('placeholder', '0000');
+ paper_id.attr('pattern', '\\d{4}');
+ paper_id.attr('required', 'required');
+ } else {
+ paper_id.val('');
+ paper_id.attr('disabled', 'disabled');
+ paper_id.removeAttr('placeholder');
+ paper_id.removeAttr('pattern');
+ paper_id.removeAttr('required');
+ }
+}
function check_password_match() {
pass = $("#pw1").val();