PascaleBeier / bootstrap-validate

A simple Form Validation Utility for Bootstrap 3 and Bootstrap 4 for Humans.
https://bootstrap-validate.js.org
MIT License
136 stars 54 forks source link

Check a group of input (well a group of 2)... #131

Open djournois opened 1 year ago

djournois commented 1 year ago

Do you imagine a way to 1) check that emails syntaxes are ok 2) have at least one of the two address filled ?

<div class="form-group">
    <label for="emailpro" class="control-label"><strong>Pro email</strong></label>
    <input type="text" class="form-control" id="emailpro" name="emailpro">
</div>
<script>
    bootstrapValidate('#emailpro', 'email:does not look like an email address');
</script>

<div class="form-group">
    <label for="emailperso"><strong>Perso email</strong></label>
    <input type="text" class="form-control" id="emailperso" name="emailperso">
</div>
<script>
    bootstrapValidate('#emailperso', 'email:does not look like an email address');
</script>
PascaleBeier commented 1 year ago

I dont think this works right now, this would be something like a "required unless" another field is present rule.