[Zope3-Users] Javascript and custom widgets

Rupert Redington rupert at neontribe.co.uk
Thu Feb 9 12:38:26 EST 2006


I'm missing something... again...

I've started writing some widgets for my current project, some of which
will make use of some javascript.

I'd like to load a script in the head of the page when such a widget is
being used (so that a window.onload function can parse the dom tree and
apply the relevant javascript to the widget). It seems a shame to add
such a script into the main template of my skin - since that will result
in the script running on every page, regardless of whether its needed.
Also that would deprive my widget of its spangly functions when being
used in another skin - such as rotterdam.

Like-wise I don't really want to write a custom template for the form.
The autoform machinery is so cool...

I hoped to find ZCML directive which would load a resource into a slot
for a particular browser:editForm/addForm. No such luck.

Looking around I found the pagelet directive that tiks uses to overcome
the same problem in places like its fckeditor widget - is this the way
forward? Is the pagelet likely to make it into the core?

What am I missing today?

Thanks in advance for any sage advice.

Rupert


More information about the Zope3-users mailing list