lundi 13 février 2017

input checkbox no update database

I have a problem, my project has the option of check if something is true or false, then i used checkbox to do it.

<div class="form-group col-md-6">
    {!! Form::label('app', 'APP') !!}<br>

    @if($Review->android == 'si')
        {!!Form::checkbox('android', 'si', true, ['id' => 'android']);!!}
    @else
        {!!Form::checkbox('android', 'no', false, ['id' => 'android']);!!}
    @endif
    {!! Form::label('Android') !!}<br>
    @if($Review->ios == 'si')
        {!!Form::checkbox('ios', 'si', true, ['id' => 'ios']);!!}
    @else
        {!!Form::checkbox('ios', 'no', false, ['id' => 'ios']);!!}
    @endif
    {!! Form::label('Ios') !!}<br>
    @if($Review->windows == 'si')
        {!!Form::checkbox('windows', 'si', true, ['id' => 'windows']);!!}
    @else
        {!!Form::checkbox('windows', 'no', false, ['id' => 'windows']);!!}
    @endif
    {!! Form::label('Windows') !!}

</div>

here is where chose the option, then i use Jquery to change of value if a person checked or unchecked one of the options.

$('#android').change(function(){
    if($(this).attr('checked')){
          $(this).removeAttr('checked');
          $(this).val('no');
     }else{
          $(this).attr('checked', true);
          $(this).val('si');
     }
});

My question if the value change, why dont change at Database?, thank you

Note: i am working on Laravel 5.2




Aucun commentaire:

Enregistrer un commentaire