mardi 2 février 2016

Check BUTTON type = submit is clicked

I am trying to check if button type submit is clicked, I have two buttons in the same form.

View sample

{!!Form::button('<i class="fa fa-trash-o"></i>', array('class' => 'btn btn-danger', 'type' => 'submit', 'name'=> 'movetrash'))!!}

I am not able to check with below

Input::get('movetrash').

This is how my condition looks like

if(Input::get('movetrash')) {
    //do something is movetrash is clicked. 
} else {
    //perform other task
}

When I submit the form with Form::submit() method then it works great:

{!!Form::submit('Move to Trash', 
 array('class' => 'btn btn-default', 'name'=> 'movetrash'))!!} 

but not with the below method (Form::button()). And I am unable to make it work with method shown below. All thought it also post the form data.

{!!Form::button('<i class="fa fa-trash-o"></i>', 
 array('class' => 'btn btn-danger', 'type' => 'submit', 'name'=> 'movetrash'))!!}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire