Scenario:
I have a form for each subject and each subject have three or four questions and the user have to answer those question then save the data on the database
The problem:
How to bind the data with the form so the form refilled with the data that inputted before by the user. I have tried a lot and search a lot to find a solution but I didn't find anything useful.
Code: View :
<div class="row">
{!! Form::model(['method' => 'PATCH','action'=>['RatingDataController@saveData'],$organisation->id,$organisation->sector->id]) !!}
<div class=" col-md-9">
<h3> {{$subject_name->subject}}</h3>
@foreach($question as $index=>$question)
<div class="plan bg-plan">
<h5>{{$question->question}}</h5>
<hr>
<!-- create sector form -->
@foreach($answers as $answer)
<div class="radio">
<label>
{!! Form::radio('row['.$index.'][answer_id]', $answer->id,true)!!}
{{$answer->answer}}
</label>
</div>
@endforeach
<div class="form-group">
{!! Form::label('comment','Comment :') !!}
{!! Form::textarea('row['.$index.'][comment]' ,null,['class'=>'form-control', 'rows' => 4]) !!}
</div>
</div>
@endforeach
</div>
{!! Form::submit('Submit Data', ['class' => 'btn btn-success submit right']) !!}
{!! Form::close() !!}
</div>
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UfDf5x
via IFTTT
Aucun commentaire:
Enregistrer un commentaire