Hello everyone, i have a simple quiz application that displays 1 question per-page to users. Everything works for now, but i noticed that once a user navigates away from a page, the radio button on the page is unchecked. Is there're a way to retain radio button checked value till the form is submitted. here is my code.
@foreach($question as $q)
<div>
<p>{{$q->question}}</p>
@foreach($q->answers['option'] as $key=>$val)
<div class="radio">
<label><input type="radio" name="{{$q->id}}_answer">{{$val}}</label>
</div>
@endforeach
</div>
@endforeach
{{$question->links() }}
</form>
You cannot use server side pagination for this. You will need a 'next' navigation that submits each page as a form, or javascript that saves the user choice with an ajax call at each choice.