How to stop Joomla from stripping HTML tags from form input?

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Thu May 21, 2009 6:22 pm

@Matt - Could you include a screenshot? Also, sometimes FireFox extensions can cause random changes to page code (especial if you're running alpha/beta versions). Have you tried viewing the Parameters panel while running Firefox in Safe Mode?

Johigh
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Aug 15, 2008 12:02 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby Johigh » Tue May 26, 2009 10:12 pm

Hi

I don't know if my problem is related to filtering but it's the most closely related issue that I've managed to find after much searching, so I'm adding to this thread.

I have created a number of articles in the back-end; when I edit them via the back-end the HTML special chars are OK. When I try to edit them via the-front end the HTML special chars are stripped from the article - NOT when I save it - they are gone when I view it in the editor (I do not use a WYSIWYG editor) - e.g. &amp; is turned into &, &pound; is turned into £. The result of this is that if I save the article via the front end I loose all of the HTML special chars.

Please note: I CAN save HTML special chars via the front end if I put them in the front-end editor - but if I then decide to edit the page again via the front end the chars are stripped when the article is brought into the editor. If I cancel the edit, the page is not altered and the special chars are intact. If I save the page then it is saved without any special chars because they were removed when the content was shown in the editor.

None of the filtering options alter this (I have tried). Is this happening to anyone else?

???

shoulders
Joomla! Intern
Joomla! Intern
Posts: 62
Joined: Fri Oct 10, 2008 9:03 pm
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby shoulders » Thu May 28, 2009 4:29 pm

please can some one tell me how to turn this feature off completely. I do not mind hacking the core.

All i want to do is insert code snippets in to my articles and use geshibot to display them as nice code.

I am using FCKeditor set to do no processing of the html, joomla whitelist/blacklist thing is set correctely.

any help will be appreciated. (and easy instructions and i am using joomla 1.5.10)

shoulders

leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Thu May 28, 2009 5:56 pm

@shoulders have you followed these instructions exactly: http://docs.joomla.org/Why_does_some_HT ... n_1.5.8%3F

shoulders
Joomla! Intern
Joomla! Intern
Posts: 62
Joined: Fri Oct 10, 2008 9:03 pm
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby shoulders » Thu May 28, 2009 6:18 pm

leolll wrote:@shoulders have you followed these instructions exactly: http://docs.joomla.org/Why_does_some_HT ... n_1.5.8%3F


yes, i am trying to paste in chuncks of php code and various other code but it keeps getting messed with. I am using FCKeditor. if i paste the code in on the front editor page (ie code) fckeditor or joomla changes all the special characters to the escapes ones. this is turned off in fckeditor so i assume this is joomla. when i paste the php code in to the source page of the fckeditor, joomla i assume is removing a lot of the code when saving and making it messy.

I have been at this ages trying to get it to work.

leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Thu May 28, 2009 7:23 pm

Assuming you have completely followed the instructions in the link to a T, here's another area you can try.

First disable FCK. You don't need more variables entered in to the debugging equation.

Go to Extensions->Plug-ins
Click on Editor - TinyMCE 2.0
Set the following:

- Code Cleanup on Startup = No
- Code cleanup on save = Never
- Do not clean HTML entities=Yes
- Prohibited Elements = DELETE EVERYTHING THERE

If that doesn't work, post an example of the code you are trying to use.

shoulders
Joomla! Intern
Joomla! Intern
Posts: 62
Joined: Fri Oct 10, 2008 9:03 pm
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby shoulders » Thu May 28, 2009 9:42 pm

hello leolll

I have done what you suggested, tiny mce adds <p> and removes blank lines.

I then thought try it without an editor, what i found is that joomla does not change the article when saved with no editor.

I also the tried JCE editor, same results as TinyMCE basic blank lines are removed and <p> added instead.

FCK editor which is the one i want to use changes some special characters and then the code gets messed up.

I use geshibot to encapsulate the code to make it look nice. (just incase you want a play otherwise it will just look like garbled text)

so basically, joomla when the whitelist/blacklist is set should not remove any html entered. the editors are responsible for changing the article on load and save.

here is the code

Code: Select all

{geshibot lang="php"}
<?php

$host = "dbXX.oneandone.co.uk";
$db = "dbXXXXXXXX";
$dbuser = "pXXXXXXX";
$dbpw = "XXXXXXX";

MYSQL_CONNECT($host, $dbuser, $dbpw) or die ( "<H3>Database Server could not be reached</H3>");
MYSQL_SELECT_DB($db) or die ( "<H3>Database not Available</H3>");

$path = getenv('DOCUMENT_ROOT')."/DB_backup";
$result = MYSQL_QUERY("SHOW TABLES");
$numrow = MYSQL_NUM_ROWS($result);

for($i = 0;$i < $numrow;$i++) {
  $table = MYSQL_RESULT($result,$i);
  echo "$table ... ";
  system(sprintf("mysqldump --opt -h $host -u $dbuser -p$dbpw $db $table | gzip > %s/$table.sql.gz",$path));
  echo "DONE\n\n";
}

MYSQL_CLOSE();

?>{/geshibot}


Thanks

matthewham
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Thu May 21, 2009 1:24 am

Re: How to stop Joomla from stripping HTML tags from form input?

Postby matthewham » Tue Jun 02, 2009 11:32 pm

Hi Leolll,

Thanks for your reply and suggestion. Apologies for taking so long to reply to your request...I had to put work on that project to one side for the last ten days or so and only now have a chance to return to it.

I tried your suggestion with Firefox in Safe mode but to no avail. As requested, I include a screenshot:

paramsm.jpg


I remain pretty confused as to what I can do so any more ideas will be most gratefully received.

Thanks again,

Matt
You do not have the required permissions to view the files attached to this post.

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Tue Jun 09, 2009 2:22 am

I, too, have this problem, have followed all wiki instructions- and still have the problem BUT not for adding/editing articles, just for fields in the community builder component.

I'm using tiny MCE, and the darned thing strips out everything after

&nbsp;

that I input in text!!!!!!!!!!!!!!!

This happens in the front end as user and backend as a superadmin- This is happening when I edit a bio field in the community builder component. Is this just happening with 3rdparty components?

thanks,
Chris

leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Tue Jun 09, 2009 3:55 am

Go to Extensions->Plug-ins
Click on Editor - TinyMCE 2.0
Set the following:

- Code Cleanup on Startup = No
- Code cleanup on save = Never
- Do not clean HTML entities=Yes
- Prohibited Elements = DELETE EVERYTHING THERE

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Tue Jun 09, 2009 12:16 pm

That's how I have it, still strips, no change....any other suggestions?

leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Tue Jun 09, 2009 6:07 pm

Are you using FF? It's a long shot, but perhaps try IE. FF addon's (like Greamonkey) can modify a web page's HTML. Worth a try.

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Tue Jun 09, 2009 6:51 pm

I just tested in IE, still the same- but as I said it doesn't happen when I edit articles in the backend, only when editing community builder profiles- I have a query on the CB forums...

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Tue Jun 09, 2009 7:53 pm

8) OK, Next test, I have another website with CB, I just tried it, NO STRIPPING.

SO I looked at the settings in tiny MCE on the working site, and changed setting to match what worked:

Code cleanup on startup off
Code cleanup: Always

Do Not Clean HTML entities No

voila, no more stripping......go figure

leolll
Joomla! Apprentice
Joomla! Apprentice
Posts: 29
Joined: Sun Sep 10, 2006 11:52 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby leolll » Tue Jun 09, 2009 8:03 pm

Sweet! Glad you got it figured out.

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Tue Jun 09, 2009 8:08 pm

Well...it kind of works. I just tried pasting in a few paragraphs from a word doc, it stripped the entire thing out....but at least I can put a &nbsp; in, small consolation

User avatar
pallavan
Joomla! Intern
Joomla! Intern
Posts: 82
Joined: Mon Oct 06, 2008 3:43 pm
Location: India
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby pallavan » Thu Sep 03, 2009 7:17 am

AmyStephen wrote:Dave -

I added your additions to the bottom of that Wiki page - will you please review and see if it makes sense?

http://docs.joomla.org/Why_does_some_HT ... n_1.5.8%3F

Thanks!
Amy :)


Works for me.
Striping of

Code: Select all

<object>
tag solved.

Radix__
Joomla! Intern
Joomla! Intern
Posts: 60
Joined: Sat Jul 04, 2009 1:44 am

Re: How to stop Joomla from stripping HTML tags from form input?

Postby Radix__ » Wed Oct 07, 2009 8:42 am

leolll wrote:Set the following:
- Code Cleanup on Startup = No
- Code cleanup on save = Never
- Do not clean HTML entities=Yes


Funny thing is: in 1.5.14: I do not have a setting "Do not clean HTML entities" !

Anyone know where it has gone?

skulldragon
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Fri Nov 06, 2009 6:19 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby skulldragon » Fri Nov 06, 2009 6:25 pm

Radix__ wrote:
leolll wrote:Set the following:
- Code Cleanup on Startup = No
- Code cleanup on save = Never
- Do not clean HTML entities=Yes


Funny thing is: in 1.5.14: I do not have a setting "Do not clean HTML entities" !

Anyone know where it has gone?



Does somebody want to answer this question? I'm sick and tired of this crappy editor stripping my tags. I've tried disabling the MCE editor and just going with no editor and the edit page wont even load, it hangs on a white page. Same thing goes for the FCK editor, so I'm STUCK using an editor that doesnt want to work.

Lemme tell ya, you guys really put out a quality product here... *rollseyes*

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19043
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby dhuelsmann » Fri Nov 06, 2009 6:41 pm

@skulldragon: You would get a lot farther in your first posts in the forums by providing information on your configuration, which version of Joomla you are using, and what you have actually tried rather then dissing the devs.

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Fri Nov 06, 2009 6:55 pm

Well, I started this string, using joomla 1.5.9, CD 1 .2, for what it's worth, which may not be much....

but my users are constantly writing me, complaining that they paste in their profile, save, and all or part is gone.....and that they aren't having trouble on other social net sites....and I've been asking for help through multiple posts since about June, still haven't found the problem.

(I write the users back, tell them to choose no editor, which works, but not my kind of workaround)

I'd be glad to pay if it could be resolved.

(BTW, if it's a clue, as admin I have to use no editor in CB backend, or I usually have the same problem.)

If you please, please help.

thanks...tb

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19043
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby dhuelsmann » Fri Nov 06, 2009 7:38 pm

@tubaboy: I would start you out by asking you to upgrade to 1.5.15 then to set your filtering options in the article manager parameters and then to go into plugins and edit TinyMCE 2.0 to be sure that functionality is set to extended and Code Cleanup on Startup is set to off and
Code cleanup on save is set to Never and delete whatever is in Prohibited Elements and in that order.
http://docs.joomla.org/Why_does_some_HTML_get_removed_from_articles_in_version_1.5.8%3F

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Sat Nov 07, 2009 2:08 am

Thanks, d, it was worth it just to achieve the upgrade I've been avoiding.

I should have been more clear, tho, sorry, the problem exists in Community Builder, and not in regular article creating/editing.

It still strips the code in user/profile edit, just as before- I'm going to try (again) in the CB forums...

tb

Radix__
Joomla! Intern
Joomla! Intern
Posts: 60
Joined: Sat Jul 04, 2009 1:44 am

Re: How to stop Joomla from stripping HTML tags from form input?

Postby Radix__ » Fri Nov 13, 2009 10:59 pm

leolll wrote:Set the following:
- Code Cleanup on Startup = No
- Code cleanup on save = Never
- Do not clean HTML entities=Yes


Funny thing is: in 1.5.15: I do not have a setting "Do not clean HTML entities" !

Anyone know where it has gone?

User avatar
dhuelsmann
Joomla! Master
Joomla! Master
Posts: 19043
Joined: Sun Oct 02, 2005 12:50 am
Location: Omaha, NE
Contact:

Re: How to stop Joomla from stripping HTML tags from form input?

Postby dhuelsmann » Sat Nov 14, 2009 1:02 am

Entity Encoding = Raw

tubaboy
Joomla! Intern
Joomla! Intern
Posts: 51
Joined: Sat Jan 24, 2009 4:45 pm

Re: How to stop Joomla from stripping HTML tags from form input?

Postby tubaboy » Sat Nov 14, 2009 1:10 am

Could you explain that last post please?

philbo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Mon Apr 05, 2010 4:08 am

Re: How to stop Joomla from stripping HTML tags from form input?

Postby philbo » Mon Apr 05, 2010 4:53 am

Hi All,

Very Frustrating, I have tried the solutions presented with no luck, only the code hack worked, and only then if you edited the article source on the database directly and did not subsequently toggle the code or load it into tinyMCE

Joomla 1.5.15
tinyMCE editor

Article Manager Config
---------------------
Added All users to the whitelist

tinyMCE editor
--------------
- Code Cleanup on Startup = No
- Code cleanup on save = Never
Entity Encoding = Raw
Prohibited Elements = I edited to null on database(backend): but the weird thing is whenever the interface is opened the text "script,applet,iframe" appears in the text entry field????




Then I tried to get the following PHP code to run in line in an article

<?php echo date('Y-m-d H:i:s');?>

When toggling between HTML/plain the PHP code was stripped out INDEPENDENTLY of any save or update to the database.

When I hacked the back end code in filterinput.php to not strip out PHP, I could get it to work by

1. pasting the PHP code into tiny and NOT toggling to edit source
2. saving.
3. When re-loading into the editor the PHP has been stripped out.

So to summarize:

You can add in line PHP by editing the database and not load or edit the article

The hack in filterinput.php
function _remove($source)
{
$loopCounter = 0;


// prevent sql injection
$source = str_replace("'", "&#39;", $source);

// Iteration provides nested tag protection
//while ($source != $this->_cleanTags($source))
//{
// $source = $this->_cleanTags($source);
// $loopCounter ++;
//}
return $source;
}

aravindha
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri May 21, 2010 4:25 pm

Re: How to stop Joomla from stripping HTML tags from form in

Postby aravindha » Fri May 21, 2010 8:47 pm

(Apologies for double posting. I posted the same query here - http://forum.joomla.org/viewtopic.php?f=474&t=398025&p=2150391#p2150391 )

Let me say that Joomla is a wonderful application for web developers/ administrators/ users alike. Now, let me come to my issue.

I use Joomla 1.5.15, and use TinyMCE Editor 2.0. Please check attached images.

I have been trying to put in Google cart/ checkout in my webpage. And, everytime i put in <form action="abdcdedf......" target="_top">, and i preview the code, the button works fine. BUT, after I save it, and run it in a browser (tried in Chrome, Opera, IE 8, Firefox), the button doesn't go anywhere, and when i go back and check the HTML, there is no <form action>, there is only <form tag="_top"> and some more <form> parameters.

I tried using 'no editor', using 'jce', using 'xvalidator', and then 'tinymce 2.0' --> all of them strip/ clean the HTML, which, of course, I deeply detest.

Browsing through the forums here in Joomla, as well Help in Google Checkout, I figured it might be one of the editors, and went through all -- and right now, since i am using TinyMCE2.0 - I modified the settings there too - according to some postings. The editor's settings changed by itself - in prohibited settings. I deleted everything that was there, but after i saved my HTML code, and came back to look at the editor's settings, there is 'applet, iframe, script' there.... Don't know how!! I need it to work asap.

I also checked in with the wiki, as well as the other suggestions here. I did NOT want to hack in to the core, before any other suggestions were made by anybody here.

If someone can help, i would be extremely glad. Thanks a lot, in advance.
You do not have the required permissions to view the files attached to this post.

wrp103
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Aug 06, 2009 6:28 pm

Re: How to stop Joomla from stripping HTML tags from form in

Postby wrp103 » Tue Jun 01, 2010 8:50 pm

I am also having problems with Joomla stripping HTML elements. I am using Joomla 1.15.12 running in Firefox on a Windows XP machine with all current updates. (I tried IE and got the same results.) I have tried all the above suggestions, but with no luck.

I created a simple component similar to the "Hello, World" example, except there are two text fields - one a short text field for a name, and the other a text area, which will have HTML tags.

I configured tinyMCE to not strip elements, but they were stripped anyway. I even lost formatting tags that were applied using tinyMCE - both using the WYSIWIG plug-ins as well as HTML mode.

I then removed the tinyMCE JS code so that I just had a plain text area, and the HTML tags were still stripped. So, my problem doesn't seem to be with any editor, but rather something else that is removing HTML tags.

What is strange is that I can add HTML formatting elements in the articles using tinyMCE, but for some reason, the content of my component gets stripped.

Any suggestions?

aravindha
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Fri May 21, 2010 4:25 pm

Re: How to stop Joomla from stripping HTML tags from form in

Postby aravindha » Wed Jun 02, 2010 2:32 am

If anybody who knows more about this issue, do enlighten us. Thanks in advance.


Return to “Extensions for Joomla! 1.5”

Who is online

Users browsing this forum: No registered users and 9 guests