View Full Version : empty HtmlEditor is not really empty

7 Oct 2010, 4:13 AM
I have a form with a simple htmleditor field inside.

If i want to clear the editor and send the empty info to my controller f.e everything is fine as long I clean the editorfield in source code view, ... if I switch to the html view and clear all entries the source code still keeps a single <br> entry.
And no, there is no empty line in the html view :)

Is this wanted? needed? changeable? a bug?


7 Oct 2010, 9:29 AM
I would also like some help with this as well. I have added a character count into the header of the HTML editor by adding a listener on the sync event, which uses:

f.getRawValue().length + " of " + f.maxLength + " characters

When I open an empty form, all of my html editors say they have 4 characters, which are the <br> characters. This is confusing to the users, and I've been playing around with trying to programatically remove the unwanted <br> to no avail

7 Oct 2010, 10:07 AM
You can use the Ext.util.Format.stripTags() function to remove HTML tags.
But... it will add &nbsp; ...

7 Oct 2010, 10:20 AM
I need the HTML tags in my count because they can do things like use a bullet list. My database column holds 4,000 characters which includes the html. The HTML editor is just giving me strange results when the field is supposed to be empty. When I highlight a row of text and delete it, firebug shows that inside the iFrame body tags i have
<br _moz_dirty="">

When I close and reopen the form, I simply have <br> in the iFrame, as described by Speedy in the original post.

Currently the only thing I can think of is trying to do a setRawValue("") to clear it out when the user first starts typing

7 Oct 2010, 10:35 AM
Just found this thread which has the exact same problem and a possible solution. Sorry for not finding it earlier.


7 Oct 2010, 11:47 PM
currently i solved the problem by filtering the sent value in the controller class, this works very good. The override of the thread is a much better solution, think I will change the code and use this instead.

Thanks a lot for your help Foster