Custom Form with WYSIWYG Element: No content update and “Show / Hide Editor” Button does not workTarget element not found for content updateShow WYSIWYG button below custom category attributeHow to add WYSIWYG editor button in phtml formMagento Insert Image on WYSIWYG editor does not show imagesShow/Hide Editor Not RespondingHow to add WYSIWYG editor button editor in backend block formMagento 2 Add new field to Magento_User admin formForm is not displayed on panel admin Magento 2Magento 2 wysiwyg editor does not load folderShow/Hide Editor not working in magento 2.2.4
Where can I find a database of galactic spectra?
Inverse-quotes-quine
Apply brace expansion in "reverse order"
How do I turn off a repeating trade?
How do I set an alias to a terminal line?
What's currently blocking the construction of the wall between Mexico and the US?
What is the origin of Scooby-Doo's name?
When to make kiddush at a Seder with no wine?
Why is the voltage measurement of this circuit different when the switch is on?
Unusual mail headers, evidence of an attempted attack. Have I been pwned?
Find the C-factor of a vote
Can White Castle?
How convert text to hex value?
How does metta sutra develop loving kindness
Would it be a copyright violation if I made a character’s full name refer to a song?
Links to webpages in books
Hot coffee brewing solutions for deep woods camping
Is using weak login credentials always bad?
Can humans ever directly see a few photons at a time? Can a human see a single photon?
What was the Shuttle Carrier Aircraft escape tunnel?
Can Ogre clerics use Purify Food and Drink on humanoid characters?
What is the legal status of travelling with methadone in your carry-on?
Has there been any indication at all that further negotiation between the UK and EU is possible?
What is this tool/thing in an Aztec painting?
Custom Form with WYSIWYG Element: No content update and “Show / Hide Editor” Button does not work
Target element not found for content updateShow WYSIWYG button below custom category attributeHow to add WYSIWYG editor button in phtml formMagento Insert Image on WYSIWYG editor does not show imagesShow/Hide Editor Not RespondingHow to add WYSIWYG editor button editor in backend block formMagento 2 Add new field to Magento_User admin formForm is not displayed on panel admin Magento 2Magento 2 wysiwyg editor does not load folderShow/Hide Editor not working in magento 2.2.4
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a problem with enabling the WYSIWYG editor in a custom admin form. With a normal textarea, everything works:
$fieldset->addField('slider_content', 'textarea', array(
'name' => 'content',
'label' => $helper->__('Content text'),
));
Now I change it to WYSIWYG:
$fieldset->addField('slider_content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text'),
'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config'),
));
And this is the layout update to include necessary JS:
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="setCanLoadTinyMce"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
</reference>
Result:
The button does not do anything visible. The hidden textarea exists and the highlighting in Firebug suggests that it is updated on click, but it stays hidden. Also it does not update its content when I make changes in the editor, so that when I save, nothing changes.
Any idea what the reason for this might be? There are no errors in the JavaScript console.
magento-1.9 adminhtml adminform wysiwyg enterprise-1.14
add a comment |
I have a problem with enabling the WYSIWYG editor in a custom admin form. With a normal textarea, everything works:
$fieldset->addField('slider_content', 'textarea', array(
'name' => 'content',
'label' => $helper->__('Content text'),
));
Now I change it to WYSIWYG:
$fieldset->addField('slider_content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text'),
'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config'),
));
And this is the layout update to include necessary JS:
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="setCanLoadTinyMce"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
</reference>
Result:
The button does not do anything visible. The hidden textarea exists and the highlighting in Firebug suggests that it is updated on click, but it stays hidden. Also it does not update its content when I make changes in the editor, so that when I save, nothing changes.
Any idea what the reason for this might be? There are no errors in the JavaScript console.
magento-1.9 adminhtml adminform wysiwyg enterprise-1.14
Try changing the config toMage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53
add a comment |
I have a problem with enabling the WYSIWYG editor in a custom admin form. With a normal textarea, everything works:
$fieldset->addField('slider_content', 'textarea', array(
'name' => 'content',
'label' => $helper->__('Content text'),
));
Now I change it to WYSIWYG:
$fieldset->addField('slider_content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text'),
'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config'),
));
And this is the layout update to include necessary JS:
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="setCanLoadTinyMce"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
</reference>
Result:
The button does not do anything visible. The hidden textarea exists and the highlighting in Firebug suggests that it is updated on click, but it stays hidden. Also it does not update its content when I make changes in the editor, so that when I save, nothing changes.
Any idea what the reason for this might be? There are no errors in the JavaScript console.
magento-1.9 adminhtml adminform wysiwyg enterprise-1.14
I have a problem with enabling the WYSIWYG editor in a custom admin form. With a normal textarea, everything works:
$fieldset->addField('slider_content', 'textarea', array(
'name' => 'content',
'label' => $helper->__('Content text'),
));
Now I change it to WYSIWYG:
$fieldset->addField('slider_content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text'),
'wysiwyg' => true,
'config' => Mage::getSingleton('cms/wysiwyg_config'),
));
And this is the layout update to include necessary JS:
<reference name="head">
<action method="setCanLoadExtJs"><flag>1</flag></action>
<action method="setCanLoadTinyMce"><flag>1</flag></action>
<action method="addJs"><script>mage/adminhtml/variables.js</script></action>
<action method="addJs"><script>mage/adminhtml/wysiwyg/widget.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
</reference>
Result:
The button does not do anything visible. The hidden textarea exists and the highlighting in Firebug suggests that it is updated on click, but it stays hidden. Also it does not update its content when I make changes in the editor, so that when I save, nothing changes.
Any idea what the reason for this might be? There are no errors in the JavaScript console.
magento-1.9 adminhtml adminform wysiwyg enterprise-1.14
magento-1.9 adminhtml adminform wysiwyg enterprise-1.14
asked Nov 23 '15 at 16:18
Fabian SchmenglerFabian Schmengler
55.4k21 gold badges145 silver badges359 bronze badges
55.4k21 gold badges145 silver badges359 bronze badges
Try changing the config toMage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53
add a comment |
Try changing the config toMage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53
Try changing the config to
Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
Try changing the config to
Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53
add a comment |
2 Answers
2
active
oldest
votes
This happens because you name your field content
. Then the TinyMCE
js looks for the element with id content
to apply the editor. But there is already a content
element on the page and it's a div
.
Adding a prefix to the form elements solves this issue because the element does not have the id content
anymore. It has something_content
.
You can add this prefix with one line of code.
$form->setHtmlIdPrefix('something_');
Doing this, you don't need to alter the form data you pass to $form->addValues
to add your prefix. It will all be done automatically.
The id prefix can be different for each tab if you have multiple tabs.
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified byaddFieldNameSuffix()
to have a different name on each tab.setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.
– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.$form = new Varien_Data_Form();
in each tab. Then you will have different instances ofVarien_Data_Form
in each tab. This will work because the elements are moved via js in an other<form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
add a comment |
The form was on a tab widget and as soon as there were multiple tabs, the elements had duplicate ids, this is what broke the editor. I added a unique prefix $elementIdPrefix
for each tab, this solved the issue:
$fieldset->addField($elementIdPrefix . 'content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text (top)'),
'wysiwyg' => true,
'config' => $wysiwygConfig,
));
To still be able to populate the form with data from a model, which is done based on the element id, I used the following code to add data:
$slideData = $this->_getCurrentSlide()->getData();
$formData = array();
foreach($slideData as $key => $value)
$formData[$elementIdPrefix . $key] = $value;
$form->addValues($formData);
$this->_getCurrentSlide()
returns the model, previously the code was just:
$form->addValues($this->_getCurrentSlide());
add a comment |
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%2f91264%2fcustom-form-with-wysiwyg-element-no-content-update-and-show-hide-editor-but%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This happens because you name your field content
. Then the TinyMCE
js looks for the element with id content
to apply the editor. But there is already a content
element on the page and it's a div
.
Adding a prefix to the form elements solves this issue because the element does not have the id content
anymore. It has something_content
.
You can add this prefix with one line of code.
$form->setHtmlIdPrefix('something_');
Doing this, you don't need to alter the form data you pass to $form->addValues
to add your prefix. It will all be done automatically.
The id prefix can be different for each tab if you have multiple tabs.
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified byaddFieldNameSuffix()
to have a different name on each tab.setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.
– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.$form = new Varien_Data_Form();
in each tab. Then you will have different instances ofVarien_Data_Form
in each tab. This will work because the elements are moved via js in an other<form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
add a comment |
This happens because you name your field content
. Then the TinyMCE
js looks for the element with id content
to apply the editor. But there is already a content
element on the page and it's a div
.
Adding a prefix to the form elements solves this issue because the element does not have the id content
anymore. It has something_content
.
You can add this prefix with one line of code.
$form->setHtmlIdPrefix('something_');
Doing this, you don't need to alter the form data you pass to $form->addValues
to add your prefix. It will all be done automatically.
The id prefix can be different for each tab if you have multiple tabs.
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified byaddFieldNameSuffix()
to have a different name on each tab.setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.
– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.$form = new Varien_Data_Form();
in each tab. Then you will have different instances ofVarien_Data_Form
in each tab. This will work because the elements are moved via js in an other<form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
add a comment |
This happens because you name your field content
. Then the TinyMCE
js looks for the element with id content
to apply the editor. But there is already a content
element on the page and it's a div
.
Adding a prefix to the form elements solves this issue because the element does not have the id content
anymore. It has something_content
.
You can add this prefix with one line of code.
$form->setHtmlIdPrefix('something_');
Doing this, you don't need to alter the form data you pass to $form->addValues
to add your prefix. It will all be done automatically.
The id prefix can be different for each tab if you have multiple tabs.
This happens because you name your field content
. Then the TinyMCE
js looks for the element with id content
to apply the editor. But there is already a content
element on the page and it's a div
.
Adding a prefix to the form elements solves this issue because the element does not have the id content
anymore. It has something_content
.
You can add this prefix with one line of code.
$form->setHtmlIdPrefix('something_');
Doing this, you don't need to alter the form data you pass to $form->addValues
to add your prefix. It will all be done automatically.
The id prefix can be different for each tab if you have multiple tabs.
edited Jun 14 at 11:24
Andhi Irawan
4561 gold badge8 silver badges20 bronze badges
4561 gold badge8 silver badges20 bronze badges
answered Nov 24 '15 at 8:43
Marius♦Marius
170k28 gold badges329 silver badges703 bronze badges
170k28 gold badges329 silver badges703 bronze badges
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified byaddFieldNameSuffix()
to have a different name on each tab.setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.
– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.$form = new Varien_Data_Form();
in each tab. Then you will have different instances ofVarien_Data_Form
in each tab. This will work because the elements are moved via js in an other<form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
add a comment |
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified byaddFieldNameSuffix()
to have a different name on each tab.setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.
– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.$form = new Varien_Data_Form();
in each tab. Then you will have different instances ofVarien_Data_Form
in each tab. This will work because the elements are moved via js in an other<form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…
– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified by
addFieldNameSuffix()
to have a different name on each tab. setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.– Fabian Schmengler
Nov 24 '15 at 8:49
Close. I already used "slider_content" as id because otherwise the whole "content" block turned into an editor :) The remaining "content" only determines the name, which is already modified by
addFieldNameSuffix()
to have a different name on each tab. setHtmlIdPrefix()
sounds like a good idea, but all tabs are within one form. If you have a solution for using a different prefix in different fieldsets of the same form, I'll happily accept the answer.– Fabian Schmengler
Nov 24 '15 at 8:49
@fschmengler.
$form = new Varien_Data_Form();
in each tab. Then you will have different instances of Varien_Data_Form
in each tab. This will work because the elements are moved via js in an other <form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…– Marius♦
Nov 24 '15 at 9:02
@fschmengler.
$form = new Varien_Data_Form();
in each tab. Then you will have different instances of Varien_Data_Form
in each tab. This will work because the elements are moved via js in an other <form>
anyway. The core does the same thing. Check this for example: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/… and this: github.com/OpenMage/magento-mirror/blob/magento-1.9/app/code/…– Marius♦
Nov 24 '15 at 9:02
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
Of course.. these are already separate Varien_Form instances. Thanks Marius, for the clean solution!
– Fabian Schmengler
Nov 24 '15 at 9:08
add a comment |
The form was on a tab widget and as soon as there were multiple tabs, the elements had duplicate ids, this is what broke the editor. I added a unique prefix $elementIdPrefix
for each tab, this solved the issue:
$fieldset->addField($elementIdPrefix . 'content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text (top)'),
'wysiwyg' => true,
'config' => $wysiwygConfig,
));
To still be able to populate the form with data from a model, which is done based on the element id, I used the following code to add data:
$slideData = $this->_getCurrentSlide()->getData();
$formData = array();
foreach($slideData as $key => $value)
$formData[$elementIdPrefix . $key] = $value;
$form->addValues($formData);
$this->_getCurrentSlide()
returns the model, previously the code was just:
$form->addValues($this->_getCurrentSlide());
add a comment |
The form was on a tab widget and as soon as there were multiple tabs, the elements had duplicate ids, this is what broke the editor. I added a unique prefix $elementIdPrefix
for each tab, this solved the issue:
$fieldset->addField($elementIdPrefix . 'content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text (top)'),
'wysiwyg' => true,
'config' => $wysiwygConfig,
));
To still be able to populate the form with data from a model, which is done based on the element id, I used the following code to add data:
$slideData = $this->_getCurrentSlide()->getData();
$formData = array();
foreach($slideData as $key => $value)
$formData[$elementIdPrefix . $key] = $value;
$form->addValues($formData);
$this->_getCurrentSlide()
returns the model, previously the code was just:
$form->addValues($this->_getCurrentSlide());
add a comment |
The form was on a tab widget and as soon as there were multiple tabs, the elements had duplicate ids, this is what broke the editor. I added a unique prefix $elementIdPrefix
for each tab, this solved the issue:
$fieldset->addField($elementIdPrefix . 'content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text (top)'),
'wysiwyg' => true,
'config' => $wysiwygConfig,
));
To still be able to populate the form with data from a model, which is done based on the element id, I used the following code to add data:
$slideData = $this->_getCurrentSlide()->getData();
$formData = array();
foreach($slideData as $key => $value)
$formData[$elementIdPrefix . $key] = $value;
$form->addValues($formData);
$this->_getCurrentSlide()
returns the model, previously the code was just:
$form->addValues($this->_getCurrentSlide());
The form was on a tab widget and as soon as there were multiple tabs, the elements had duplicate ids, this is what broke the editor. I added a unique prefix $elementIdPrefix
for each tab, this solved the issue:
$fieldset->addField($elementIdPrefix . 'content', 'editor', array(
'name' => 'content',
'label' => $helper->__('Content text (top)'),
'wysiwyg' => true,
'config' => $wysiwygConfig,
));
To still be able to populate the form with data from a model, which is done based on the element id, I used the following code to add data:
$slideData = $this->_getCurrentSlide()->getData();
$formData = array();
foreach($slideData as $key => $value)
$formData[$elementIdPrefix . $key] = $value;
$form->addValues($formData);
$this->_getCurrentSlide()
returns the model, previously the code was just:
$form->addValues($this->_getCurrentSlide());
answered Nov 24 '15 at 8:08
Fabian SchmenglerFabian Schmengler
55.4k21 gold badges145 silver badges359 bronze badges
55.4k21 gold badges145 silver badges359 bronze badges
add a comment |
add a comment |
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%2f91264%2fcustom-form-with-wysiwyg-element-no-content-update-and-show-hide-editor-but%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
Try changing the config to
Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('add_variables' => false, 'add_widgets' => false,'files_browser_window_url'=>$this->getBaseUrl().'admin/cms_wysiwyg_images/index/')),
– Renon Stewart
Nov 23 '15 at 17:42
@R.S It dit not make a difference. I found out that the problem is related to multiple tabs that all contained field with the same id
– Fabian Schmengler
Nov 24 '15 at 7:53