|
1 {% extends "soc/role/edit.html" %} |
|
2 {% comment %} |
|
3 Licensed under the Apache License, Version 2.0 (the "License"); |
|
4 you may not use this file except in compliance with the License. |
|
5 You may obtain a copy of the License at |
|
6 |
|
7 http://www.apache.org/licenses/LICENSE-2.0 |
|
8 |
|
9 Unless required by applicable law or agreed to in writing, software |
|
10 distributed under the License is distributed on an "AS IS" BASIS, |
|
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
12 See the License for the specific language governing permissions and |
|
13 limitations under the License. |
|
14 {% endcomment %} |
|
15 {% block scripts %} |
|
16 {{ block.super }} |
|
17 <script type="text/javascript"> |
|
18 $(document).ready( function() { |
|
19 function swap_fields(school_type) { |
|
20 if (school_type == "University") { |
|
21 $("tr:contains('Grade cannot be left blank')").hide(); |
|
22 $("label[for=id_grade]").hide(); |
|
23 $("#id_grade").hide(); |
|
24 $("tr:contains('Major cannot be left blank'):parent").show(); |
|
25 $("tr:contains('Degree must be selected from the given options')").show(); |
|
26 $("label[for=id_major]").show(); |
|
27 $("#id_major").show(); |
|
28 $("label[for=id_degree]").show(); |
|
29 $("#id_degree").show(); |
|
30 } else if (school_type == "High School") { |
|
31 $("tr:contains('Grade cannot be left blank')").show(); |
|
32 $("label[for=id_grade]").show(); |
|
33 $("#id_grade").show(); |
|
34 $("tr:contains('Major cannot be left blank')").hide(); |
|
35 $("tr:contains('Degree must be selected from the given options')").hide(); |
|
36 $("label[for=id_major]").hide(); |
|
37 $("#id_major").hide(); |
|
38 $("label[for=id_degree]").hide(); |
|
39 $("#id_degree").hide(); |
|
40 } |
|
41 else { |
|
42 $("td.formfielderror:contains('Grade cannot be left blank')").hide(); |
|
43 $("label[for=id_major]").hide(); |
|
44 $("#id_major").hide(); |
|
45 $("td.formfielderror:contains('Major cannot be left blank')").hide(); |
|
46 $("td.formfielderror:contains('Degree must be selected from the given options')").hide(); |
|
47 $("label[for=id_degree]").hide(); |
|
48 $("#id_degree").hide(); |
|
49 $("label[for=id_grade]").hide(); |
|
50 $("#id_grade").hide(); |
|
51 } |
|
52 } |
|
53 swap_fields($("#id_school_type").val()); |
|
54 $("#id_school_type").change(function() { |
|
55 swap_fields($(this).val()); |
|
56 }); |
|
57 }); |
|
58 </script> |
|
59 {% endblock %} |