diff --git a/lms/templates/register.html b/lms/templates/register.html
index 636435444b..cfd61eeec2 100644
--- a/lms/templates/register.html
+++ b/lms/templates/register.html
@@ -33,6 +33,34 @@
});
});
+
+ (function() {
+ $(document).delegate('#register-form', 'ajax:success', function(data, json, xhr) {
+ if(json.success) {
+ $('.message.submission-error').removeClass('is-shown');
+ toggleSubmitButton();
+ location.href="${reverse('dashboard')}";
+ } else {
+ $('.status.message.submission-error').addClass('is-shown');
+ $('.status.message.submission-error .message-copy').html(json.value).stop().css("display", "block");
+ $(".field-error").removeClass('field-error');
+ $("[data-field='"+json.field+"']").addClass('field-error')
+ }
+ });
+ })(this);
+
+ function toggleSubmitButton(e) {
+ var $msgError = $('form .status.submission-error');
+ var $submitButton = $('form .form-actions #submit').prop('disabled', true);
+
+ if(!$msgError.hasClass('is-shown')) {
+ $submitButton.prop('disabled', true);
+ }
+
+ else {
+ $submitButton.prop('disabled', false);
+ }
+ }
%block>
@@ -208,21 +236,4 @@
Need help in registering with edX? View our FAQs for answers to commonly asked questions. Once registered, most questions can be answered in the course specific discussion forums or through the FAQs.
-
-
-
-
-
+
\ No newline at end of file