I have added a field as per Magento standard structure, hidden field appeared but value is not showing.

$fieldset->addField('entity_type_id', 'hidden', 
      'name'               => 'entity_type_id',
      'value'              => 11

NOTE : I have tried 'value' instead of 'values' but not working

Can anyone suggest how can I set the field value in Magento 2 admin form.

2 Answers 2


custom field with field value


NOTE : I got reference from this answer and it is working perfectly fine for me for hidden field as well for text field.


Try This :-

Reference :- vendor/magento/module-sales/Block/Adminhtml/Order/Status/NewStatus/Form.php

Line no. 40

$fieldset->addField('entity_type_id', 'hidden', 
      'name' => 'entity_type_id',
      'value' => 11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.