[solved] Adding Custom Fields with HTML Content

Your code modifications and patches you want to share with others.
Locked
zvenson99
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Dec 07, 2010 10:20 am

[solved] Adding Custom Fields with HTML Content

Post by zvenson99 » Tue Dec 07, 2010 10:43 am

Hi!
I'm using Joomla 1.5.22 and i've managed to create a couple of custom fields for my joomla! articles using this post:
http://forum.joomla.org/viewtopic.php?p ... 5#p1568915
but when i insert html code into these fields in the joomla backend the html gets removed when i click on apply or save.
I have no idea on how to stop joomla from removing my html tags. Actually i want to get rid of this function at all as there wont be any front-end editing possibilities...
I guess it has nothing to do with the tinyMCE Plugin Settings because these custom fields don't use TinyMCE for text input. *

*Edit: I managed to use TinyMCE for my custom fields but even if i use tinyMCE for Text Input all the html Tags are removed...The strange thing is that in my Content Part the htmltags are not removed ???

my field types are VARCHAR and MEDIUMTEXT and i want to allow html for all or at least a few of them. But J! always removes everything between <>.

It would be great if somebody could help me! I'm starting to become desperate about this thing.... :'(
Thank you!
Last edited by zvenson99 on Thu Dec 09, 2010 9:11 am, edited 1 time in total.

 
zvenson99
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Dec 07, 2010 10:20 am

Re: Adding Custom Fields with HTML Content

Post by zvenson99 » Thu Dec 09, 2010 9:11 am

found a solution. Added:

$row->my_field = JRequest::getVar( 'my_field', '', 'post', 'string', JREQUEST_ALLOWRAW );

to the function saveContentPrep in the file

/administrator/components/com_content/helper.php

coloradojon
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Jan 11, 2010 7:44 pm

Re: [solved] Adding Custom Fields with HTML Content

Post by coloradojon » Sat Jan 01, 2011 4:53 am

I've spent many an hour trying to figure out a very similar problem. I want to be able to include html tags in a textarea in an extension, but they get wiped out when it is saved. It sounds like this fix may do the trick, but I am rather inexperienced on this level and would appreciate a little added guidance with two questions. ???

One, I can get to the right file and section, but is there any particular place that line should be added? Two, did you insert the line as written here or change out part of it for your field type or name?

Thanks for any help you can lend.

zvenson99
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Tue Dec 07, 2010 10:20 am

Re: [solved] Adding Custom Fields with HTML Content

Post by zvenson99 » Thu Jan 06, 2011 11:55 am

Hi coloradojon!

Sorry for the late response but i hope i can help you with this.

Just go to the file:
/administrator/components/com_content/helper.php.

then find the code

Code: Select all

$text = JRequest::getVar( 'text', '', 'post', 'string', JREQUEST_ALLOWRAW );
at line 28 and just add my code underneath in a new line and save. This should do the trick. Of course you have to change the "my_field" string to the your fieldname.

Hope this helps!

 

Locked

Return to “Core Hacks and Patches”