vendredi 5 juin 2015

All checkbox in checkbox group automatically is checked with “Input::old()” when come back after fail validation

I have a array of checkbox group. In beginning, no checkbox is checked. After press submit button, if any checkbox group were not checked, it will return old form with existing input. My problem is : when return old form, all of checkbox belongs to checkbox group that according to rule (has at least one checkbox is checked) is checked.

I don't know why just one checkbox is checked before submitting, and when it returns, all of checkbox in that checkbox group is checked.

My view

{!! Form::checkbox('checkbox['.$count.']', $value,Input::old('checkbox['.$count.']',false)) !!}

My controller

            return Redirect::back()
            ->withErrors($validator) // send back all errors to the login form
            ->withInput(Input::all()); // send back the input (not the password) so that we can repopulate the form

Anyone know how to resolve my problem or give me some suggestion?




Aucun commentaire:

Enregistrer un commentaire