ZF-10516: Empty Zend_Dojo_Form_Element_Editor returns <br _moz_editor_bogus_node="TRUE" />

Issue Type: Bug Created: 2010-10-03T11:51:07.000+0000 Last Updated: 2011-08-01T12:43:50.000+0000 Status: Resolved Fix version(s): - 1.11.6 (05/May/11)

Reporter: Greg Szczotka (greg606) Assignee: Robert Basic (robertbasic) Tags: - Zend_Dojo

Related issues: Attachments:


When submitting empty form. The value of the field created by Zend_Dojo_Form_Element_Editor instead of being empty contains the value:

I found a solution here:… It's as simple as adding filter to editor:

->setFilters(array('StringTrim', array('PregReplace',array('#
#i','')) ))

But I guess this bug should be solved anyway. Regards, Greg

Firefox 3.6.10

it's similar to the bug: but i'm not sure if these are the same things as the author seems to focus on another thing.


Posted by Robert Basic (robertbasic) on 2011-04-22T21:41:32.000+0000

I've been looking into this for a while now, looks like Firefox adds that BR tag on it's own. Googling/IRCing didn't help. Same issue also appears/appeared in editors like CKEditor and FCKEditor.

The following code snippet/patch shows how we could fix this, but this looks hacky/dirty. Also it breaks one test (testHelperShouldCreateJavascriptToConnectEditorToHiddenValue); that test tests for the line which is edited/deleted in the patch bellow.

<pre class="highlight">
--- library/Zend/Dojo/View/Helper/Editor.php    (revision 23865)
+++ library/Zend/Dojo/View/Helper/Editor.php    (working copy)
@@ -178,7 +178,11 @@
function() {
     var form = zend.findParentForm(dojo.byId('$hiddenId'));
     dojo.connect(form, 'submit', function(e) {
-        dojo.byId('$hiddenId').value = dijit.byId('$editorId').getValue(false);
+        var value = dijit.byId('$editorId').getValue(false);
+        if(dojo.isFF) {
+            value = value.replace(/<br></br>/, '');
+        }
+        dojo.byId('$hiddenId').value = value;

Posted by Matthew Weier O'Phinney (matthew) on 2011-05-02T17:18:12.000+0000

Patch actually looks reasonable; the functionality that exists is largely due to inconsistencies in how browsers handle textarea submissions coming from non-textarea input.

I've applied the patch to trunk and the 1.11 release branch, along with test modifications.

Posted by Robert Basic (robertbasic) on 2011-08-01T12:43:50.000+0000

Pull request for porting the patch in ZF2 is sent:

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.