Added Javascript to disable accommodation fields when accommodation is not required.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Mon, 08 Nov 2010 00:47:39 +0530
changeset 201 2363acb15410
parent 200 e31a620a511b
child 202 b4391b3d5fcc
Added Javascript to disable accommodation fields when accommodation is not required.
project/templates/registration/submit-registration.html
--- a/project/templates/registration/submit-registration.html	Mon Nov 08 00:47:57 2010 +0530
+++ b/project/templates/registration/submit-registration.html	Mon Nov 08 00:47:39 2010 +0530
@@ -2,6 +2,29 @@
 
 {% block title %}Submit Registration{% endblock %}
 
+{% block addscripts %}
+  <script type="text/javascript">
+
+  $(document).ready(function(){
+    if (!$('#id_accommodation_required').is(':checked')) {
+      $('#id_accommodation_days').attr('disabled', 'disabled');
+      $('#id_sex').attr('disabled', 'disabled');
+    }
+    $('#id_accommodation_required').change(function() {
+      if (!$('#id_accommodation_required').is(':checked')) {
+        $('#id_accommodation_days').attr('disabled', 'disabled');
+        $('#id_sex').attr('disabled', 'disabled');
+      } else {
+        $('#id_accommodation_days').removeAttr('disabled');
+        $('#id_sex').removeAttr('disabled');
+      }
+    });
+  });
+
+
+  </script>
+{% endblock addscripts %}
+
 {% block content %}
     {% block formheading %}
       <h1>Submit Registration</h1>