Commit 286760f4 authored by Romain Loth's avatar Romain Loth

add conditional subquestion for 'other institution type'

parent 912138af
......@@ -273,6 +273,8 @@ def save_to_db(safe_recs_arr):
def read_records(incoming_data):
"""
runs sanitization as needed
NB custom made for regcomex/templates/base_form
"""
# init var
......@@ -303,6 +305,9 @@ def read_records(incoming_data):
elif field == 'last_modified_date':
rdate = incoming_data[field]
# special treatment for "other" subquestions
if clean_records['institution_type'] == 'other' and 'other_institution_type' in incoming_data:
clean_records['institution_type'] = sanitize(incoming_data['other_institution_type'])
return (duuid, rdate, clean_records)
......
......@@ -58,6 +58,7 @@ var captchaCheck = document.getElementById('my-captchaHash')
var subPage1Style = document.getElementById('subpage_1').style
var subPage2Style = document.getElementById('subpage_2').style
var teamCityDivStyle = document.getElementById('team_city_div').style
var otherInstDivStyle = document.getElementById('other_institution_div').style
// param for generation & validation
var realCaptchaLength = 5
......@@ -612,16 +613,16 @@ var passwords = [pass1, pass2]
// £DEBUG autofill ----------->8------
//first_name.value = "Jean"
//last_name.value = "Tartampion"
//initialsInput.value="JPP"
//document.getElementById('country').value = "France"
//email.value= makeRandomString(10)+"@om.fr"
//pass1.value="123456+789"
//pass2.value="123456+789"
//document.getElementById('jobtitle').value = "atitle"
//document.getElementById('keywords').value = "Blabla"
//document.getElementById('institution').value = "CNRS"
first_name.value = "Jean"
last_name.value = "Tartampion"
initialsInput.value="JPP"
document.getElementById('country').value = "France"
email.value= makeRandomString(10)+"@om.fr"
pass1.value="123456+789"
pass2.value="123456+789"
document.getElementById('jobtitle').value = "atitle"
document.getElementById('keywords').value = "Blabla"
document.getElementById('institution').value = "CNRS"
// --------------------------->8------
......
......@@ -141,7 +141,7 @@
<input id="country" name="country" maxlength="60"
type="text" class="form-control autocomp"
placeholder="pays"
onblur="if(this.value=='France'){teamCityDivStyle.display = 'block'}">
onblur="if(this.value=='France'){teamCityDivStyle.display = 'block'} else {teamCityDivStyle.display='none'}">
</div>
<!-- EMAIL & PASSWORD -->
......@@ -220,19 +220,30 @@
<div class="input-group">
<label for="institution_type" class="smlabel input-group-addon">* Institution Type</label>
<select id="institution_type" name="institution_type"
class="custom-select form-control">
<option selected value="1">University</option>
<option value="2">Public sector R&amp;D organization</option>
<option value="2">Other public sector organization</option>
<option value="3">Private sector organization</option>
<option value="4">None at the moment</option>
<option value="5">Other</option>
<!-- TODO other => show text -->
class="custom-select form-control"
onchange="if(this.value=='other'){otherInstDivStyle.display = 'block'} else {otherInstDivStyle.display='none'}">
<option selected value="university">University</option>
<option value="public R&amp;D org">Public sector R&amp;D organization</option>
<option value="public other org">Other public sector organization</option>
<option value="private org">Private sector organization</option>
<option value="none">None at the moment</option>
<option value="other"
onclick="otherInstDivStyle.display = 'block'"
>Other</option>
</select>
</div>
<!-- Other institution type <=> only if previous choice == 5 -->
<div class="question conditional-q" id="other_institution_div">
<div class="input-group">
<label for="other_institution_type" class="smlabel input-group-addon">Other type</label>
<input id="other_institution_type" name="other_institution_type" maxlength="120"
type="text" class="form-control" placeholder="Clarify here the type of your parent institution">
</div>
</div>
</div>
<div class="question">
<div class="input-group">
<label for="team_lab" class="smlabel input-group-addon">Lab / Team / Dept</label>
......
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