Welcome Guest, Not a member yet? Register   Sign In
Active record + wysiwyg
#1

[eluser]Peter Pumpkineater[/eluser]
Hi,

Im a bit stuck now. I have a simple form with wisiwyg editor on textearea and I want to save its content to db using active record.
Problem is that all html tags gets escaped.
How can I avoid it?

Thnx
#2

[eluser]exodus7[/eluser]
can you post your code so we can see how your implementing it?
#3

[eluser]beaufrusetta[/eluser]
Which WYSIWYG are you using? It shouldn't be escaping the HTML - but if we could see a snapshot of your code, that'd be fantastic. :-)
#4

[eluser]InsiteFX[/eluser]
Active Record, Insert and Update.
Note: All values are escaped automatically producing safer queries.

InsiteFX
#5

[eluser]Peter Pumpkineater[/eluser]
It regular form -> form valiation (wysiwyg field has trim and required rules) and simple insert/update at the very end.
I end up with something like this
Quote:SDa & l t ;br& g t ;sdsasd& l t ;br& g t;a asd& l t ;br& g t ;
(I added spaces to display it properly) in db...
So I guess its not escaped but url encoded...
#6

[eluser]InsiteFX[/eluser]
This may help you.

PHP.net - htmlentities

InsiteFX
#7

[eluser]Peter Pumpkineater[/eluser]
Thank you IsiteFX, but I know I can decode it.
What I would like to achieve is to save pure HTML to database.
#8

[eluser]LuckyFella73[/eluser]
You didn't mention which editor you are using. Usually you can
set a flag in the config file to prevent the output to be
converted.

In CK Editor you would set:
Code:
config.entities = false;
#9

[eluser]Peter Pumpkineater[/eluser]
It is called wysiwyg jquery plugin, but Firebug shows that this particular field is submited as pure html. So either Firebug decode entiteis on the fly or it is changed in form validation or/and in db driver...
#10

[eluser]LuckyFella73[/eluser]
I don't know that jquery plugin so I can't say how to configure that ...
But CI doesn't convert into entities - active record just escapes your
input but that is not your problem.
If you don't get it to work with that plugin you could use CKEditor for
example and show/hide the rte with jquery in case you don't want to display
it by default.




Theme © iAndrew 2016 - Forum software by © MyBB