Forum OpenACS Development: GoogleMap Widget on ad_form

Request notifications

Collapse
Posted by Iuri Sampaio on
Hi there,

I wonder if a for container with 3 different widgets, using GoogleMap API, within ad_form template would take too much effort that I better not even start it.

The goal is to create a form element as a container with three widgets:
1. input text with autocomplete JS using Google API,
2. input checkbox list with JS integration with the map
3. The actual Google Map integrated with both others fields.

if the user interact with one or another, their info displayed must be aligned.
The visual result will be sort of the picture at:
http://iurix.com/file-storage/view/Diapositive1.png

Best wishes

Collapse
Posted by Antonio Pisano on
Hello Iuri,

I cannot give precise indications about the javascript sorcery you will probably require to achieve your result, but to creare a "pure ad_form" widget it should be sufficient to refer to this:
http://openacs.org/api-doc/proc-view?proc=template%3a%3aelement%3a%3acreate&source_p=1

so basically create a new template::widget::googlemaps and a corresponding validator template::data::validate::googlemaps (name will be of your choice of course). Validator can be something as trivial as "return 1", depending on the logic of your widget.

As reference you can have a look at the various widgets and validators already defined:
http://openacs.org/api-doc/proc-view?proc=template%3a%3awidget
http://openacs.org/api-doc/proc-view?proc=template%3a%3adata%3a%3avalidate

Hope this helps

Collapse
Posted by Iuri Sampaio on
Hi there,

Yes, it helps a lot. I see it changes the perspective. They show a way to create a whole new widget, such as category pkg does, which in fact is a better approach (modular, easy to reuse and etc.)

I'm also getting back to old documentation about ad_form, plus grabbing some samples of code from classic packages such as bug-tracker, calendar, and of course, acs-subsite.

Thanks again Antonio.

http://openacs.org/file/493854/ad_form%20cheat%20sheet.pdf