I'm using Symfony 5 and php7.
{{ form_widget(form.groupTab) }}<input type="hidden" id="ce-participants__type" data-field="app_registration_group_type_form[groupTab]" value="0">
I want to get the value attribute within the hidden input field. It should return '0' as string.
In my controller I`ve tried following:
$groupTab = $form->get('groupTab')->getViewData();
but I always get an empty string as response => ''
CodePudding user response:
First, your hidden field has no name
attribute, so I'm not even sure you can get its value back.
You should create that field with the form builder, just as you do the groupTab field. Then you can get its value with $form->get('yourHiddenField')->getData()
.