[opencms-dev] can direct edit do call-back javascript functions?

Tobias Herrmann t.herrmann at alkacon.com
Mon Aug 8 15:48:06 CEST 2011


Hi,

when you use the direct edit function within a container page in OpenCms 8 the HTML fragment for the changed content will be generated by the server to replace the previous content on the client side. Any java-script you included in the HTML will be removed before inserting the HTML into the DOM to 
avoid errors that would be caused by any document write operations. Also java-script code that is run on document load won't be executed again for the newly included HTML.

This is probably the reason for you jquery pugin not to work.

Currently it is not possible to supply a callback function that would be called after the edited content is included into the page. You can request this feature using bugzilla.

Even though this won't help you plugin to work, on the server side you can access the information, if the HTML your element formatter jsp is generating will used to load a whole new page or just a content fragment when editing a page. Use EL to access ${cms.edited}, this will be true if your element 
content is not generated in the context of a whole page and therefore java-script will not be executed on it (@see org.opencms.jsp.util.CmsStandardContextBean.isEdited()). You can use this to supply the user with information, why your java-script will only work, after the page was saved.

Greetings, Tobias

--

Alkacon Software GmbH - The OpenCms Experts

http://www.alkacon.com  --  http://www.opencms.org



Am 06.08.2011 10:02, schrieb yangguang:
> hi.
> I use v8.0.1 . I use a jquery slider, it works when the page load first time. but when I edit any html with the direct, it did not work ,because it did not load the jquery slider. so I must refresh the page.
>
> my question is : when I finished editing page , is there a way to add my callback javascript function ?
>
> thanks.
>
>
>
> *******************************************
>
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20110808/f81aa08e/attachment.htm>


More information about the opencms-dev mailing list