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, ] );

3
0

Try the code like this one :

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