I am using bootstrap validation for other input fields in this form using ‘required’ attribute. but for this two fields if at least one is not empty than form should be submitted.
<form class="needs-validation" action="opportunity_handling.php" novalidate method="POST">
<div class="form-group col-md-6" >
<label>Opportunity OTC Value:</label>
<div class="input-group">
<input type="number" class="form-control" name="valueOTC">
</div>
</div>
<div class="form-group col-md-6" >
<label>Opportunity MRC Value:</label>
<div class="input-group">
<input type="number" class="form-control" name="valueMRC">
</div>
</div>
</form>
2
Answers
You can use the jQuery validation plugin to validate that at least one of the two fields is not empty before submitting the form.
You can use the data-attribute data-bv-one-field-required-by-name to validate that at least one of the two fields is not empty using Bootstrap validation.
You can use the HTML required attribute on both fields and then add a custom validation rule to the form. This custom validation rule will check if at least one of the two fields is not empty.