I added a custom form field that is Banner Mobile Image and it working fine with me

but when i clicked in edit option this field is not showing in the form

here my code is

<field name="bannermobileimage">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <item name="dataType" xsi:type="string">string</item>
                <item name="source" xsi:type="string">banners</item>
                <item name="label" xsi:type="string" translate="true">Banner Mobile Image</item>
                <item name="visible" xsi:type="boolean">true</item>
                <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">true</item>
                <item name="formElement" xsi:type="string">fileUploader</item>
                <item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item> 
               <item name="previewTmpl" xsi:type="string">Magento_Catalog/image-preview</item> 
               <item name="dataScope" xsi:type="string">bannermobileimage</item>
                <item name="required" xsi:type="boolean">false</item>
                <item name="sortOrder" xsi:type="number">16</item>
                <item name="uploaderConfig" xsi:type="array">
                    <item name="url" xsi:type="url" path="banners/banners_image/upload"/>
  • did you clear the cache? Are you sure that there is no other field with the name bannermobileimage? Did you add the field in the same fieldset? – Marius Dec 7 '18 at 12:49
  • i did the all above things a couple of times and also check multiple times this is no other field with same name ... – Akash Agrawal Dec 7 '18 at 12:54

You may need to create another controller to upload the Mobile banner Image and change the Field ID on that new controller to "bannermobileimage".

Please update the form's UI Component XML for New Controller path. (Assume new controller file name for Mobile banner image upload is "Mobileupload.php")

<item name="uploaderConfig" xsi:type="array">
 <item name="url" xsi:type="url" path="banners/banners_image/mobileupload"/>

To save the new field value in the Database, you may need to update the corresponding Interface and Model class.

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.