Moved required fields logic to js

This commit is contained in:
Luis Aleixo 2021-11-29 14:06:03 +01:00
parent 75ce9f29c5
commit b32e81b052
2 changed files with 10 additions and 4 deletions

View file

@ -239,8 +239,14 @@ function on_ventilation_type_change() {
function on_wearing_mask_change() {
wearing_mask = $('input[type=radio][name=mask_wearing_option]')
wearing_mask.each(function (index) {
if (this.checked) getChildElement($(this)).show();
else getChildElement($(this)).hide();
if (this.checked) {
getChildElement($(this)).show();
require_fields(this);
}
else {
getChildElement($(this)).hide();
require_fields(this);
}
})
}

View file

@ -260,9 +260,9 @@
<br>
<div class='sub_title'>Are masks worn when occupants are at workstations?</div>
<input type="radio" id="mask_on" name="mask_wearing_option" value="mask_on" data-enables="#DIVmasks_used" required>
<input type="radio" id="mask_on" name="mask_wearing_option" value="mask_on" data-enables="#DIVmasks_used">
<label for="mask_on">Yes</label>
<input class="ml-2" type="radio" id="mask_off" name="mask_wearing_option" value="mask_off" required checked="checked">
<input class="ml-2" type="radio" id="mask_off" name="mask_wearing_option" value="mask_off" checked="checked">
<label for="mask_off">No</label><br>
<div id="DIVmasks_used" style="display:none">