jeudi 19 octobre 2017

Laravel Form Input hidden keep returning empty

Description

I have a form

<form method="POST" accept-charset="UTF-8" action="http://site/account/1003/destroy">
  <input name="_method" type="hidden" value="DELETE">
  <input name="_token" type="hidden" value="pBRx8u17C6KHFxzfhatx0BpnmOF5x55EWSP2lpis">
  <input name="id" type="hidden" value="1003">
  <a data-dismiss="modal" class="btn btn-danger mr10">No</a>
  <button type="submit" class="btn btn-success" data-toggle="modal" data-target=".bs-example-modal-lg"> Yes </button>
</form>

As you can see the id has the value of 1003.


Attempt

I'ved to test in my destroy() function

public function destroy($id)
{
    dd(Input::all());
    ...

I got

array:3 [▼
  "_method" => "DELETE"
  "_token" => "pBRx8u17C6KHFxzfhatx0BpnmOF5x55EWSP2lpis"
  "id" => "" <------ empty 
]

I double check everything. I could not seem to know what is the cause of my id to be empty while I can clearly see it in the HTML in my browser.


Questions

How would one go about and debug this further ?


I'm open to any suggestions at this moment.

Any hints/suggestions / helps on this be will be much appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire