我有一个向导表单,其中包含一个标记为“隐藏”字段的字段。直到我确定是否要显示。进入向导步骤时,该字段将被隐藏。如果我点击“下一步”,则该字段正在验证而不是被忽略。
<div class="row">
<div class="col-md-6">
<div class="form-group" id="alcohol_allowed" style="visibility: hidden">
<label class="col-form-label require">Will There be Alcohol Served?:</label>
<div class="custom-controls">
<label class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="grpAlcohol" id="rdoAlcoholNo" style="visibility: hidden"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">No</span>
</label>
<label class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="grpAlcohol" id="rdoAlcoholYes" style="visibility: hidden"/>
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Yes</span>
</label>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group" id="resident_non" style="visibility: hidden">
<label class="col-form-label require">Resident or Non-Resident?:</label>
<div class="custom-controls">
<label class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="grpResidency" id="rdoResident" style="visibility: hidden" />
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Resident</span>
</label>
<label class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="grpResidency" id="rdoNonresident" style="visibility: hidden" />
<span class="custom-control-indicator"></span>
<span class="custom-control-description">Non-Resident</span>
</label>
</div>
</div>
</div>
</div>
我已经搜索并尝试了我能想到的任何组合,但它仍然在验证。我使用formvalidation.io:
$('#frmFacilityReservation')
.formValidation({
framework: 'bootstrap',
excluded: [':disabled', ':hidden', ':not(:visible)'],
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
cmbFacilityName: {
validators: {
notEmpty: {
message: 'Please choose the facility you wish to reserve.'
},
blank: {},
}
},
dteReservationDateStart: {
validators: {
notEmpty: {
message: 'Please enter your reservation start date and time.'
},
checkMinimumDaysInAdvance: {},
checkMaximumDaysInAdvance: {},
checkAvailableDaysTimes: {},
}
},
dteReservationDateEnd: {
validators: {
verbose: false,
notEmpty: {
message: 'Please enter your reservation end date and time.'
},
checkHourDifference: {},
}
},
txtPurposeOfUse: {
validators: {
notEmpty: {
message: 'Enter the reason for the reservation.'
},
}
},
'grpAlcohol': {
validators: {
notEmpty: {
message: 'Please choose whether or not alcohol is going to be present'
}
},
},
'grpResidency': {
validators: {
notEmpty: {
message: 'Please choose whether you are resident or non-resident.'
}
},
},
},
})