0

I want to set default Value Set For Magento 2 Admin Form Text Field Default Value Set.So Plz If Any Idea Help.Thanks In Advance. $fieldset->addField( 'name', 'text', ['name' => 'name', 'label' => __('Name'), 'title' => __('Name'), 'required' => true, ] );

0

Try the code like this one :

$fieldset->addField(
                'name',
                'text',
                ['name' => 'name', 
                'label' => __('Name'), 
                'title' => __('Name'), 
                'required' => true,
                'value' => 'your default value' 
                ]
);
| improve this answer | |
  • Just a doubt. Does that values be rewritten afterwards? – Mr Zid Feb 28 at 12:08
  • Yes, you can edit when you add or edit the record. – Dhiren Vasoya Feb 28 at 12:09
  • Not Working Try – Ashish Bhungani Feb 29 at 7:39
  • which issue you are facing? – Dhiren Vasoya Feb 29 at 8:58
  • Default Value Not Set In Admin Form Using Above Code – Ashish Bhungani Mar 2 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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