1
I have a form that I receive an email address and what type of email. Filling in the fields should not be mandatory. If the email is completed, please provide the type.
Following example:
- Email - Optional
Email Type - Optional
Email - Case Filled
- Email Type - Required.
Following form I’m using:
<form action="" method="POST" enctype="multipart/form-data">
<div class="form-group col-md-6">
<div class="input-group">
<input type="email" class="form-control" value="" id="email" name="email"
placeholder="Email">
<select class="form-control select2" name="tipo_email" style="width: 100%;">
<option value="" selected="">Selecione</option>
<option value="1">Pessoal</option>
<option value="2">Corporativo</option>
</select>
</div>
</div>
<button type="submit">Enviar</button>
</form>
I tried to use Laravel validation required_unless but I couldn’t. Someone can help me ?
mano bom dia, você usar o Rule::requiredIf https://laravel.com/docs/5.8/validation#Rule-required-if
– Joan Marcos