1

I have this two slice of code in a blade's page:

     <td>
      <input type="image" src={{ URL::asset('img/edit_icon.png') }}
       height="36" alt="Submit" class="btn editCompanyButton" 
       id="edit_company"  data-toggle="modal" data-target="#editCompanyModal" />
    </td>

and

 <td>
 {!! Form::open(['url' => 'admin/users', 'method' => 'delete']) !!}
 {{ Form::hidden('user_id', $user->id, array('id' => 'user_id')) }}
 {{ Form::submit('Cancella Utente', array('class' => 'btn')) }}
 {!! Form::close() !!}
</td>

at the load of the page both works fine, then if i push the edit button the delete button is switched for i don't know what reason to a post method!

<form method="POST" action="http://localhost:8000/admin/users" accept-charset="UTF-8">
<input name="_token" type="hidden" value="iUSNtcrJWBElATJ5k98etNcGlbhukFsVNnMyuAdM">
<input id="user_id" name="user_id" type="hidden" value="3">
<input type="image" src="http://localhost:8000/img/delete_icon.png" height="32" alt="Submit">

instead of this slice, that is correctly rendered at the load of the page:

<form method="POST" action="http://localhost:8000/admin/companies" accept-charset="UTF-8">    
<input name="_method" type="hidden" value="DELETE">
<input name="_token" type="hidden" value="iUSNtcrJWBElATJ5k98etNcGlbhukFsVNnMyuAdM">
<input id="company_id" name="company_id" type="hidden" value="2}">
<input type="image" src="http://localhost:8000/img/delete_icon.png" height="32" alt="Submit">
</form>

so why hitting the edit button make the delete button switched to another form structure?

JahStation
  • 726
  • 2
  • 9
  • 25
  • https://stackoverflow.com/questions/5967564/form-inside-a-table Should answer your question. Forms should not be defined within a tablular element. – Matt Burrow Jun 23 '17 at 11:28
  • thanks, but i dont think that my problem comes from this – JahStation Jun 23 '17 at 12:14
  • Good luck in thinking that then ;) – Matt Burrow Jun 23 '17 at 13:19
  • what are your routes? – Odinovsky Jun 23 '17 at 23:09
  • the user's route part:Route::get('/users', 'UserController@usersManagement'); Route::post('/users', 'UserController@saveUser'); Route::put('/users', 'UserController@editUser'); Route::delete('/users', 'UserController@deleteUser'); Route::post('/users/activate', 'UserController@activateUser'); – JahStation Jun 26 '17 at 08:07

0 Answers0