Commit 08bc06e3 by Matthew Mongeau

Fixed form for signup

parent af5de27a
...@@ -16,18 +16,18 @@ ...@@ -16,18 +16,18 @@
<label>Public Username</label> <label>Public Username</label>
<input name="username" type="text" placeholder="Public Username"> <input name="username" type="text" placeholder="Public Username">
<label>Full Name</label> <label>Full Name</label>
<input name="full-name" type="text" placeholder="Full Name"> <input name="name" type="text" placeholder="Full Name">
<label>Your Location</label> <label>Your Location</label>
<input name="location" type="text" placeholder="Your Location"> <input name="location" type="text" placeholder="Your Location">
<label>Prefered Language</label> <label>Prefered Language</label>
<input name="language" type="text" placeholder="Prefered Language"> <input name="language" type="text" placeholder="Prefered Language">
<label class="terms-of-service"> <label class="terms-of-service">
<input name="terms" type="checkbox"> <input name="terms_of_service" type="checkbox" value="true">
I agree to the I agree to the
<a href="#">Terms of Service</a> <a href="#">Terms of Service</a>
</label> </label>
<label class="honor-code"> <label class="honor-code">
<input name="honor-code" type="checkbox"> <input name="honor_code" type="checkbox" value="true">
I agree to the I agree to the
<a href="#">Honor Code</a> <a href="#">Honor Code</a>
, sumarized below as: , sumarized below as:
...@@ -73,39 +73,34 @@ ...@@ -73,39 +73,34 @@
<script type="text/javascript"> <script type="text/javascript">
(function() { (function() {
function getCookie(name) { function getCookie(name) {
return $.cookie(name); return $.cookie(name);
} }
function postJSON(url, data, callback) {
$.ajax({type:'POST',
url: url,
dataType: 'json',
data: data,
success: callback,
headers : {'X-CSRFToken':getCookie('csrftoken')}
});
}
$('form#enroll_form').submit(function(e) { function postJSON(url, data, callback) {
e.preventDefault(); $.ajax({type:'POST',
var submit_data={}; url: url,
$.each($("[id^=ca_]"), function(index,value){ dataType: 'json',
submit_data[value.name]=value.value; data: data,
}); success: callback,
$.each($("[id^=cb_]"), function(index,value){ headers : {'X-CSRFToken':getCookie('csrftoken')}
submit_data[value.name]=value.checked;
}); });
}
postJSON('/create_account', $('form#enroll_form').submit(function(e) {
submit_data, e.preventDefault();
function(json) { var submit_data = $('#enroll_form').serialize();
if(json.success) {
$('#enroll').html(json.value); postJSON('/create_account',
} else { submit_data,
$('#enroll_error').html(json.value).stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000); function(json) {
} if(json.success) {
} $('#enroll').html(json.value);
); } else {
}); $('#enroll_error').html(json.value).stop().css("background-color", "#933").animate({ backgroundColor: "#333"}, 2000);
}
}
);
});
})(this) })(this)
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment