I have the form below for a user to register in a congress.
There is this section where the user inser the name and surname of each participant.
I have a checkbox "Fill the following fields with the authenticated user information." and if the user select this checkbox I want to populate the input fields name and surname with the name
and surname
of the authenticated user. Do you know how to achieve that?
The checkbox is only to allow the user to, if he is also a participant, instead of enter his name and surname click in the checkbox and he dont need to enter his name and surname, its automatic.
@foreach(range(1,$selectedRtype['quantity']) as $test)
<h6>Participant - 1 - {{$test}}</h6>
<div class="form-check">
<input class="form-check-input" type="radio" name="" value="">
<label class="form-check-label d-flex align-items-center" for="exampleRadios1">
<span class="mr-auto">Fill the following fields with the authenticated user information.</span>
</label>
</div>
<div class="form-group font-size-sm">
<label for="participant_name" class="text-gray">Name</label>
<input type="text" name="participant_name[]" required class="form-control" value="">
</div>
<div class="form-group font-size-sm">
<label for="participant_surname" class="text-gray">Surname</label>
<input type="text" required class="form-control" name="participant_surname[]" value="">
</div>
@endforeach
Full form:
<form method="post" id="step1" action="">
{{csrf_field()}}
@if (!empty($allParticipants))
@if($allParticipants == 1)
<p>Please enter the following information:.</p>
@foreach($selectedRtypes as $selectedRtype)
@foreach(range(1,$selectedRtype['quantity']) as $test)
<h6>Participant - 1 - {{$test}}</h6>
<div class="form-check">
<input class="form-check-input" type="radio" name="" value="referencias">
<label class="form-check-label d-flex align-items-center" for="exampleRadios1">
<span class="mr-auto">Fill the following fields with the authenticated user information.</span>
</label>
</div>
<div class="form-group font-size-sm">
<label for="participant_name" class="text-gray">Name</label>
<input type="text" name="participant_name[]" required class="form-control" value="">
</div>
<div class="form-group font-size-sm">
<label for="participant_surname" class="text-gray">Surname</label>
<input type="text" required class="form-control" name="participant_surname[]" value="">
</div>
@endforeach
@endforeach
@endif
@else
<p>Is not necessary additional info the tickets will be send to Auth::user()->email.</p>
@endif
<input type="submit" href="#step2free"
id="goToStep2Free" class="btn btn-primary btn float-right next-step" value="Go to step 2"/>
</form>