Magento2 : Save Button Not Working in Admin Form Custom ModuleMagento 2 add extra button in backendAdmin Form is displaying on left Tab section in Magento CE 1.9.2Magento 2 : Not able to save admin form after adding multiple tabsChange save button text in admin formmagento2 admin grid edit form checkbox not checkedMagento 2 save grid data from admin formMagento2 admin form routing issueUnable to create admin form using layoutCustom button in adminhtml edit moduleSave Button Redirecting to Same Admin Form in Magento 2
Do you need to let the DM know when you are multiclassing?
Converting from CMYK to RGB (to work with it), then back to CMYK
Why are MBA programs closing in the United States?
Does the Nuka-Cola bottler actually generate nuka cola?
Are the guests in Westworld forbidden to tell the hosts that they are robots?
If I had a daughter who (is/were/was) cute, I would be very happy
Find the Missing Members of this Powered Sequence
Why did the World Bank set the global poverty line at $1.90?
Difference between prepositions in "...killed during/in the war"
Use 1 9 6 2 in this order to make 75
How can powerful telekinesis avoid violating Newton's 3rd Law?
How to destroy a galactic level civilization and still leave behind primitive survivors?
Can you make an identity from this product?
Housemarks (superimposed & combined letters, heraldry)
Confused with atmospheric pressure equals plastic balloon’s inner pressure
Command of files and size
The origin of the Russian proverb about two hares
How can I write the maximally mixed state on m qubits as a linear combination of basis vectors
A Salute to Poetry
How precise must a satellite's orbit be?
How to avoid typing 'git' at the begining of every Git command
C++ logging library
How to befriend someone who doesn't like to talk?
Is it okay to have a sequel start immediately after the end of the first book?
Magento2 : Save Button Not Working in Admin Form Custom Module
Magento 2 add extra button in backendAdmin Form is displaying on left Tab section in Magento CE 1.9.2Magento 2 : Not able to save admin form after adding multiple tabsChange save button text in admin formmagento2 admin grid edit form checkbox not checkedMagento 2 save grid data from admin formMagento2 admin form routing issueUnable to create admin form using layoutCustom button in adminhtml edit moduleSave Button Redirecting to Same Admin Form in Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am Working on A magento 2 custom Module
i have a Form as well a Product Grid in my form so i created tabs using block but Whenever
i click on save button gives me Javascript Error
TypeError: $.data(...) is undefined
Here is my form
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEditForm.php
namespace vendor nameModule nameBlockAdminhtmlBackgroundImageEdit;
class Form extends MagentoBackendBlockWidgetFormGeneric
/**
* Prepare form
*
* @return $this
*/
public function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post',
'enctype' => 'multipart/form-data'
]
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
Here is my Edit page where i Defined my Button
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEdit.php
namespace FvendorNamemoduleNameBlockAdminhtmlBackgroundImage;
class Edit extends MagentoBackendBlockWidgetFormContainer
protected $_coreRegistry = null;
public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
)
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
protected function _construct()
$this->_objectId = 'backgroundimage_id';
$this->_blockGroup = 'FME_BackgroundImage';
$this->_controller = 'adminhtml_backgroundImage';
parent::_construct();
if ($this->_isAllowedAction('FME_BackgroundImage::save'))
$this->buttonList->update('save', 'label', __('Save Image'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
else
$this->buttonList->remove('save');
/**
* Retrieve text for header element depending on loaded page
*
* @return string
*/
public function getHeaderText()
if ($this->_coreRegistry->registry('backgroundimage')->getId())
return __(
"Edit BackgroundImage '%1'",
$this->escapeHtml($this->_coreRegistry->registry('backgroundimage')->getTitle())
);
else
return __('New BackgroundImage');
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
public function _isAllowedAction($resourceId)
return $this->_authorization->isAllowed($resourceId);
/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/
public function _getSaveAndContinueUrl()
return $this->getUrl(
'backgroundimage/*/save',
['_current' => true, 'back' => 'edit', 'active_tab' => 'tab_id']
);
public function getFormActionUrl()
if ($this->hasFormActionUrl())
return $this->getData('form_action_url');
return $this->getUrl('*/*/save');
/**
* Prepare layout
*
* @return MagentoFrameworkViewElementAbstractBlock
*/
public function _prepareLayout()
$this->_formScripts[] = "
function toggleEditor()
if (tinyMCE.getInstanceById('page_content') == null)
tinyMCE.execCommand('mceAddControl', false, 'page_content');
else
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
;
";
return parent::_prepareLayout();
magento2 php module javascript custom
|
show 2 more comments
I am Working on A magento 2 custom Module
i have a Form as well a Product Grid in my form so i created tabs using block but Whenever
i click on save button gives me Javascript Error
TypeError: $.data(...) is undefined
Here is my form
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEditForm.php
namespace vendor nameModule nameBlockAdminhtmlBackgroundImageEdit;
class Form extends MagentoBackendBlockWidgetFormGeneric
/**
* Prepare form
*
* @return $this
*/
public function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post',
'enctype' => 'multipart/form-data'
]
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
Here is my Edit page where i Defined my Button
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEdit.php
namespace FvendorNamemoduleNameBlockAdminhtmlBackgroundImage;
class Edit extends MagentoBackendBlockWidgetFormContainer
protected $_coreRegistry = null;
public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
)
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
protected function _construct()
$this->_objectId = 'backgroundimage_id';
$this->_blockGroup = 'FME_BackgroundImage';
$this->_controller = 'adminhtml_backgroundImage';
parent::_construct();
if ($this->_isAllowedAction('FME_BackgroundImage::save'))
$this->buttonList->update('save', 'label', __('Save Image'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
else
$this->buttonList->remove('save');
/**
* Retrieve text for header element depending on loaded page
*
* @return string
*/
public function getHeaderText()
if ($this->_coreRegistry->registry('backgroundimage')->getId())
return __(
"Edit BackgroundImage '%1'",
$this->escapeHtml($this->_coreRegistry->registry('backgroundimage')->getTitle())
);
else
return __('New BackgroundImage');
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
public function _isAllowedAction($resourceId)
return $this->_authorization->isAllowed($resourceId);
/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/
public function _getSaveAndContinueUrl()
return $this->getUrl(
'backgroundimage/*/save',
['_current' => true, 'back' => 'edit', 'active_tab' => 'tab_id']
);
public function getFormActionUrl()
if ($this->hasFormActionUrl())
return $this->getData('form_action_url');
return $this->getUrl('*/*/save');
/**
* Prepare layout
*
* @return MagentoFrameworkViewElementAbstractBlock
*/
public function _prepareLayout()
$this->_formScripts[] = "
function toggleEditor()
if (tinyMCE.getInstanceById('page_content') == null)
tinyMCE.execCommand('mceAddControl', false, 'page_content');
else
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
;
";
return parent::_prepareLayout();
magento2 php module javascript custom
do u see any error in console?
– i_ali55
Mar 21 at 9:19
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29
|
show 2 more comments
I am Working on A magento 2 custom Module
i have a Form as well a Product Grid in my form so i created tabs using block but Whenever
i click on save button gives me Javascript Error
TypeError: $.data(...) is undefined
Here is my form
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEditForm.php
namespace vendor nameModule nameBlockAdminhtmlBackgroundImageEdit;
class Form extends MagentoBackendBlockWidgetFormGeneric
/**
* Prepare form
*
* @return $this
*/
public function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post',
'enctype' => 'multipart/form-data'
]
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
Here is my Edit page where i Defined my Button
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEdit.php
namespace FvendorNamemoduleNameBlockAdminhtmlBackgroundImage;
class Edit extends MagentoBackendBlockWidgetFormContainer
protected $_coreRegistry = null;
public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
)
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
protected function _construct()
$this->_objectId = 'backgroundimage_id';
$this->_blockGroup = 'FME_BackgroundImage';
$this->_controller = 'adminhtml_backgroundImage';
parent::_construct();
if ($this->_isAllowedAction('FME_BackgroundImage::save'))
$this->buttonList->update('save', 'label', __('Save Image'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
else
$this->buttonList->remove('save');
/**
* Retrieve text for header element depending on loaded page
*
* @return string
*/
public function getHeaderText()
if ($this->_coreRegistry->registry('backgroundimage')->getId())
return __(
"Edit BackgroundImage '%1'",
$this->escapeHtml($this->_coreRegistry->registry('backgroundimage')->getTitle())
);
else
return __('New BackgroundImage');
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
public function _isAllowedAction($resourceId)
return $this->_authorization->isAllowed($resourceId);
/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/
public function _getSaveAndContinueUrl()
return $this->getUrl(
'backgroundimage/*/save',
['_current' => true, 'back' => 'edit', 'active_tab' => 'tab_id']
);
public function getFormActionUrl()
if ($this->hasFormActionUrl())
return $this->getData('form_action_url');
return $this->getUrl('*/*/save');
/**
* Prepare layout
*
* @return MagentoFrameworkViewElementAbstractBlock
*/
public function _prepareLayout()
$this->_formScripts[] = "
function toggleEditor()
if (tinyMCE.getInstanceById('page_content') == null)
tinyMCE.execCommand('mceAddControl', false, 'page_content');
else
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
;
";
return parent::_prepareLayout();
magento2 php module javascript custom
I am Working on A magento 2 custom Module
i have a Form as well a Product Grid in my form so i created tabs using block but Whenever
i click on save button gives me Javascript Error
TypeError: $.data(...) is undefined
Here is my form
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEditForm.php
namespace vendor nameModule nameBlockAdminhtmlBackgroundImageEdit;
class Form extends MagentoBackendBlockWidgetFormGeneric
/**
* Prepare form
*
* @return $this
*/
public function _prepareForm()
/** @var MagentoFrameworkDataForm $form */
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getData('action'),
'method' => 'post',
'enctype' => 'multipart/form-data'
]
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
Here is my Edit page where i Defined my Button
vendorNamemoduleNameBlockAdminhtmlBackgroundImageEdit.php
namespace FvendorNamemoduleNameBlockAdminhtmlBackgroundImage;
class Edit extends MagentoBackendBlockWidgetFormContainer
protected $_coreRegistry = null;
public function __construct(
MagentoBackendBlockWidgetContext $context,
MagentoFrameworkRegistry $registry,
array $data = []
)
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
protected function _construct()
$this->_objectId = 'backgroundimage_id';
$this->_blockGroup = 'FME_BackgroundImage';
$this->_controller = 'adminhtml_backgroundImage';
parent::_construct();
if ($this->_isAllowedAction('FME_BackgroundImage::save'))
$this->buttonList->update('save', 'label', __('Save Image'));
$this->buttonList->add(
'saveandcontinue',
[
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => [
'mage-init' => [
'button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form'],
],
]
],
-100
);
else
$this->buttonList->remove('save');
/**
* Retrieve text for header element depending on loaded page
*
* @return string
*/
public function getHeaderText()
if ($this->_coreRegistry->registry('backgroundimage')->getId())
return __(
"Edit BackgroundImage '%1'",
$this->escapeHtml($this->_coreRegistry->registry('backgroundimage')->getTitle())
);
else
return __('New BackgroundImage');
/**
* Check permission for passed action
*
* @param string $resourceId
* @return bool
*/
public function _isAllowedAction($resourceId)
return $this->_authorization->isAllowed($resourceId);
/**
* Getter of url for "Save and Continue" button
* tab_id will be replaced by desired by JS later
*
* @return string
*/
public function _getSaveAndContinueUrl()
return $this->getUrl(
'backgroundimage/*/save',
['_current' => true, 'back' => 'edit', 'active_tab' => 'tab_id']
);
public function getFormActionUrl()
if ($this->hasFormActionUrl())
return $this->getData('form_action_url');
return $this->getUrl('*/*/save');
/**
* Prepare layout
*
* @return MagentoFrameworkViewElementAbstractBlock
*/
public function _prepareLayout()
$this->_formScripts[] = "
function toggleEditor()
if (tinyMCE.getInstanceById('page_content') == null)
tinyMCE.execCommand('mceAddControl', false, 'page_content');
else
tinyMCE.execCommand('mceRemoveControl', false, 'page_content');
;
";
return parent::_prepareLayout();
magento2 php module javascript custom
magento2 php module javascript custom
edited Jun 4 at 7:28
Sarfaraj Sipai
4251619
4251619
asked Mar 21 at 9:12
Waqar AliWaqar Ali
64
64
do u see any error in console?
– i_ali55
Mar 21 at 9:19
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29
|
show 2 more comments
do u see any error in console?
– i_ali55
Mar 21 at 9:19
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29
do u see any error in console?
– i_ali55
Mar 21 at 9:19
do u see any error in console?
– i_ali55
Mar 21 at 9:19
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266801%2fmagento2-save-button-not-working-in-admin-form-custom-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266801%2fmagento2-save-button-not-working-in-admin-form-custom-module%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
do u see any error in console?
– i_ali55
Mar 21 at 9:19
I got this in console TypeError: $.data(...) is undefined
– Waqar Ali
Mar 21 at 9:20
u have extented your edit class from "MagentoBackendBlockWidgetFormContainer" u should extend it from this class MagentoBackendBlockWidget
– i_ali55
Mar 21 at 9:21
Now getting this error Notice: Undefined property: VendormoduleBlockAdminhtmlBackgroundImageEdit::$buttonList
– Waqar Ali
Mar 21 at 9:24
u have used $this->buttonList object which does not belongs to any other class.
– i_ali55
Mar 21 at 9:29