Forum OpenACS Q&A: Implementing custom widgets

Collapse
Posted by Thomas Taylor on
I would like to implement my own custom widget, but since the documentation for ACS Templating links to an empty document, I post this message here.

To get to know the widgets implemented already I fussed a little bit with the date-widget. After that I copied date-procs.tcl and changed all stuff inside according to my widget.
Although an template::util::mywidget wrapper for template::util::mywidget::somecommand exists, as well as template::widget::mywidget and template::data::validate::mywidget the widget does not work.

I'm using ad_from to build my form, but instead of mywidget I get a textbox (there should be a menu and a textbox along with some HTML-remarks), so I figured that for some reason the code for mywidget never gets executed.

Can anybody tell me where to find documentation on widgets and what is the absolute minimum of functions, etc. for any widget to work in OACS 4.5?

Collapse
Posted by Don Baccus on
For starters, could you retry with OACS 4.6?  I did some tweaking of things in order to get custom widgets and ad_form to work together and you won't find them in OACS 4.5.

We do need documentation on this, one could say I embarked on a journey of discovery when I figured out how to get this stuff to work when I was helping the Greenpeace folks.

I do know off the top of my head that all you need to make a type available is to define template::data::validate:yourtype, and all you need to do to make a widget available is to define  template::widget::yourtype.

So it does seem that you're doing the right thing.

You did restart AOLserver, right?  And you did name your new .tcl file "foo-procs.tcl" rather than just "foo.tcl", right?  (it won't be sourced at startup if it's not named "*-init.tcl" or "*-procs.tcl")

Collapse
3: Re: Implementing custom (response to 1)
Posted by Jon Griffin on
Since I already started the ad_form documentation, I will volunteer to document the template system et. al.

All I ask is that anyone who has docs or suggestions send them to me so I don't have to reinvent the wheel. There are many parts of templating that I really had no use for so I don't have any notes. This goes for the wizard docs also.