I have created a custom form in admin and added a image upload field in the form. When we edit a form having uploaded image in it, it shows preview of that image as small thumbnail. enter image description here After clicking on that preview image, image opens in same tab but I want it to open in new tab. Can anyone help me here.

below is my code : app/code/Vendor/Module/Block/Adminhtml/Grid/Edit/Form.php

                'name' => 'file',
                'label' => __('File Upload'),
                'id' => 'file',
                'note' => 'Allowed File Types are .jpg , .jpeg, .png, .pdf ',
  • did you get a solution? I am facing the same issue.
    – nil108
    Feb 1, 2022 at 13:45
  • I don't get the solution but I created a new fiwld woith same name and disaled it. if ($model->getEntityId()) { $fieldset->addField( 'file', 'image', [ 'label' => __('Attachement By Seller'), 'disabled' => 'true', ] ); } Hope it works for you as well. Feb 3, 2022 at 13:23


Your Answer

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