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;








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();











share|improve this question
























  • 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

















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();











share|improve this question
























  • 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













0












0








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();











share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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










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



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림