• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Active record + wysiwyg

[eluser]Peter Pumpkineater[/eluser]

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?


can you post your code so we can see how your implementing it?

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. :-)

Active Record, Insert and Update.
Note: All values are escaped automatically producing safer queries.


[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...

This may help you.

PHP.net - htmlentities


[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.

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

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

[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...

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.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.