May Sale! All accounts are 40% off this week.

Ain's avatar
Level 1

How to add confirmation message before deleting

I already google about this but couldn't understand on how to do it with my project. And i'm not good in javascript. Can anybody help me?

This is my controller

 public function unassigned_judge(Request $request){

        $judge_id = $request->input('judge_id');
        $judge = User::findOrFail($judge_id);
        $booth_id = $request->input('booth_id');
        $judge->booth()->detach($booth_id);


        return redirect()->back();
    }

This is my blade

<div class="col-sm-6">
                <b>Judges List:</b><br/>
                    @foreach($booth->judge as $j)
                        {!! Form::open(['method' => 'POST', 'action' => ['BoothUserController@unassigned_judge']]) !!}
                            <input type="hidden" name="booth_id" value="{{$booth->id}}">
                            <input type="hidden" name="judge_id" value="{{$j->id}}">
                            <tr>
                                <td width="50%"> {{$j->name}} </td>

                                {{--<td width="50%"> {!! Form::submit('Unassigned Judge', ['class'=>'btn btn-danger']) !!} </td><br/>--}}
                                <button title='Unassigned Judge' type="delete"  class="btn btn-danger">Unassigned Judge</button>
                            </tr>
                        {!! Form::close() !!}
                    @endforeach

            </div>

0 likes
3 replies
JackL's avatar
JackL
Best Answer
Level 17
  <button type="submit" class="btn btn-danger" onclick="return confirm('Delete This? Well Okay!')">Delete</button>

2 likes
Ain's avatar
Level 1

@JACKL - Oh my god, it works! Thank you JACKL for saving my life! Have a great day :)

Please or to participate in this conversation.