CKeditor in a loaded component

105 views
Skip to first unread message

Jim S

unread,
Jul 10, 2014, 5:25:37 PM7/10/14
to web...@googlegroups.com
Has anyone gotten CKeditor working in a textarea in a loaded component?

When I try it, it keeps telling me the field is null even if I have text in it.

It works fine for me in textareas outside of a component.  I had the same result whether I used the CKeditor web2py plugin or just integrated it into my code on my own.

Any thoughts/experience?

Is there a different editor that works better in this instance?  I also tried TinyMCE but that didn't like the ajax reloading on error.  I couldn't get it to re-initialize the editor because it thought the editor was already initialized.

-Jim

Leonel Câmara

unread,
Jul 10, 2014, 6:40:40 PM7/10/14
to web...@googlegroups.com
I have it working fine using the latest ckeditor web2py plugin. What seems to be happening here is that ckeditor isn't actually being associated with your field's textarea for some reason.

Tim Richardson

unread,
Jul 12, 2014, 5:33:03 AM7/12/14
to web...@googlegroups.com
The plugin is on web2pyslices and can be installed via admin. The book talks about using web2pyslices and plugins.

Jim Steil

unread,
Jul 12, 2014, 10:20:22 AM7/12/14
to web...@googlegroups.com

I'm aware of that. But I can't get it to work inside if s component loaded on my page. Works fine when not in a component.

Jim

On Jul 12, 2014 4:33 AM, "Tim Richardson" <t...@growthpath.com.au> wrote:
The plugin is on web2pyslices and can be installed via admin. The book talks about using web2pyslices and plugins.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Ee6lWPgk52o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Leonel Câmara

unread,
Jul 15, 2014, 6:53:06 AM7/15/14
to web...@googlegroups.com
I'm using the plugin in a loaded component without any problems, did you follow Tim's slice carefully?

The only problem I had when using it in a loaded component was for file uploading and browsing. To solve it I have this in my models before ckeditor.define_tables()

# To avoid routing problems in case we're not the default app and in case we're in a LOAD and the extension for URLs isn't HTML
ckeditor.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')


However you seem to be having a different problem altogether.

Tim Richardson

unread,
Jul 15, 2014, 8:54:20 AM7/15/14
to web...@googlegroups.com
You'll have to show us some code I think. 

Jim S

unread,
Jul 15, 2014, 11:40:57 AM7/15/14
to web...@googlegroups.com
I just wrote a test app to show the bad behavior, but it works with the CKEditor plugin.  Guess I'll have to check other reasons for the failure with the code in my other app.

Thanks to all for your input!

-Jim

Rahul

unread,
Jul 16, 2014, 1:13:24 AM7/16/14
to web...@googlegroups.com
Hey Everybody - Although this question is a bit different, I was wondering how to preserve the formatting that's done for a field Using CKEditor when the field is serialized in a view.

Thanks, Rahul D.

Leonel Câmara

unread,
Jul 16, 2014, 4:25:50 AM7/16/14
to web...@googlegroups.com
Rahul you use the XML helper. For instance, let's suppose I have a table 'page' with a field 'body' which I have set with ckeditor. In the view I can do:
{{=XML(page.body, sanitize=False)}}

If you can trust the input "sanitize=False" is a good idea (for instance if it can only be changed in the backoffice by members of the administration), otherwise remove the sanitize=False.

Rahul

unread,
Jul 17, 2014, 12:46:37 AM7/17/14
to web...@googlegroups.com
Thanks! Leonel. That helps. :-)

Cheers, Rahul.
Reply all
Reply to author
Forward
0 new messages