PHP Nette AJAX - dynamic form with multiselect - not post data (This field is required)
Hello,
I have a form in my PHP Nette application that is redrawn using AJAX in a snippet and contains multiselect. Ajax repainting is in order and the form contains the correct data, but when I send it over and over the message This field is required. However, the data is actually sent, but the succeeded method does not accept it. Specifically, the array field from muliselect for $ acl_resource is empty - Tracy in the container but POST data sees ....
This is the output:
---------------------------
DUMP $values in app
---------------------------
---------------------------
TRACY CONTAINER
---------------------------
Good day,
data ($values) from the form from multiSelect (ie array) redrawn by AJAX must be taken in raw form via getHttpData:
SOLUTION
---------------------------
I have a form in my PHP Nette application that is redrawn using AJAX in a snippet and contains multiselect. Ajax repainting is in order and the form contains the correct data, but when I send it over and over the message This field is required. However, the data is actually sent, but the succeeded method does not accept it. Specifically, the array field from muliselect for $ acl_resource is empty - Tracy in the container but POST data sees ....
This is the output:
---------------------------
DUMP $values in app
---------------------------
Nette\Utils\ArrayHash
acl_tag => "group1" (6)
acl_resource => array ()
acl_role => "powerusers" (10)
---------------------------
TRACY CONTAINER
---------------------------
httpData private =>
acl_resource =>
0 => "dfgdgfdfdg"
1 => "Fdfsdfsdf5"
2 => "fdgfdgfdg"
3 => "sfdgfdgdfgd"
send => "Změnit"
_token_ => "1dia9tcaqlQh5bfs9zHm9mrM8Cnvi0j+b+Bg4="
acl_tag => "group1"
acl_role => "powerusers"
_do => "permissionsMultiEditForm-submit"
REPLY
Good day,
data ($values) from the form from multiSelect (ie array) redrawn by AJAX must be taken in raw form via getHttpData:
SOLUTION
---------------------------
public function permissionsMultiEditFormSucceeded($form, $values)
{
$data = $form->getHttpData(form::DATA_LINE, 'acl_resource[]');
dump($data);
}