Merge branch 'fix/date-picking' into 'master'
Ensure that the maximum number of infected people remains below the total number Closes #65 See merge request cara/cara!59
This commit is contained in:
commit
c0057a144a
2 changed files with 12 additions and 3 deletions
|
|
@ -76,8 +76,8 @@ Beta v1.0.0 <span style="float:right; font-weight:bold">Please send feedback to
|
|||
<!-- Event Options -->
|
||||
<b>Event data:</b><br>
|
||||
Attendees:<br>
|
||||
Total number of occupants: <input type="number" id="total_people" name="total_people" min=1 onchange="document.getElementById('infected_people').max=this.value" required><br>
|
||||
Number of infected people: <input type="number" id="infected_people" name="infected_people" min=1 max="document.getElementById('total_people').value" required><br>
|
||||
Total number of occupants: <input type="number" id="total_people" name="total_people" min=1 required><br>
|
||||
Number of infected people: <input type="number" id="infected_people" name="infected_people" min=1 required><br>
|
||||
<hr width="80%">
|
||||
Activity type: <select id="activity_type" name="activity_type">
|
||||
<option value="office">Office</option>
|
||||
|
|
|
|||
|
|
@ -144,6 +144,10 @@ function require_lunch(option) {
|
|||
$("#lunch_finish").prop('required',option);
|
||||
}
|
||||
|
||||
function setMaxInfectedPeople(){
|
||||
$("#infected_people").attr("max", $("#total_people").val());
|
||||
}
|
||||
|
||||
/* -------UI------- */
|
||||
$(function() {
|
||||
$(".datepicker").datepicker({
|
||||
|
|
@ -221,8 +225,13 @@ function objectifyForm(formArray) {
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// Setup the maximum number of people at page load (to handle back/forward),
|
||||
// and update it when total people is changed.
|
||||
setMaxInfectedPeople();
|
||||
$("#total_people").change(setMaxInfectedPeople);
|
||||
|
||||
var radioValue = $("input[name='event_type']:checked");
|
||||
if(radioValue.val()){
|
||||
require_fields(radioValue.get(0));
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue