I'm having trouble trying to manage data from a form. The problem is that when submitting a form, some of the data gets normally sent (as always), but some other data is seen as empty.
This is the case: when I submit my form, in Chrome tools (Network tab), I can see the request payload that has all the data correctly formatted, but when dumping the $this->request->data
variable in my controller, I can see that some of the fields are missing.
For example, I have a multiple-select with name='data[GamesHome]'
, and another one with name='data[GamesMenuDesktop]'
, and when selecting some options for each select and submitting, this is the request payload that generates:
------WebKitFormBoundaryMluBtWwVE1VAOgZ3
Content-Disposition: form-data; name="data[GamesHome][]"
13258
------WebKitFormBoundaryMluBtWwVE1VAOgZ3
Content-Disposition: form-data; name="data[GamesHome][]"
995
------WebKitFormBoundaryMluBtWwVE1VAOgZ3
Content-Disposition: form-data; name="data[GamesMenuDesktop][]"
13893
But when dumping the $this->request->data
attribute, I can see that the GamesHome array has the two correct ids (13258 and 995), but the GamesMenuDesktop is empty.
What is causing this? The request is sent correctly, so I assume that the problem persists in my Controller...
Thanks!
Edit: here's the HTML of the form
<form class="well" id="DomainAdminEditForm" enctype="multipart/form-data" method="post" accept-charset="utf-8">
<div class="form-group">
<label for="DomainGamesHomeDesktop">GamesHome</label>
<select class="form-control select-multiple-games-ajax select2-hidden-accessible" multiple="" id="DomainGamesHomeDesktop" name="data[GamesHome][]" tabindex="-1" aria-hidden="true">
<!---Various <option> tags-->
</select>
</div>
<div class="form-group">
<label for="DomainGamesMenuDesktop">GamesMenuDesktop</label>
<select class="form-control select-multiple-games-ajax select2-hidden-accessible" multiple="" id="DomainGamesMenuDesktop" name="data[GamesMenuDesktop][]" tabindex="-1" aria-hidden="true">
<!---Various <option> tags-->
</select>
</div>
</form>