Forum OpenACS Q&A: Re: examples of widgets using Ajaxhelper?

Collapse
Posted by Brian Fenton on
Just coming back to answer my own question. I was trying to build a pulldown which when you select an option, creates a multi-select using Ajax. I wanted 2 of these "widgets" on a page and they had to be able to work in edit mode and display the previously saved values.

In the end I didn't create a widget - I just used a template::form select widget which called a JavaScript function in the -html option (onClick). If you're new to Ajax like me, the hardest part was figuring out the Prototype calls, I eventually got that working from this documentation http://prototypejs.org/doc/latest/ajax/Ajax/Updater/

To get the edit mode working, I used the onLoad functionality to call the same JavaScript function to automatically open the multi-select.

Overall I was very happy with my Ajaxhelper experience and once you get used to it, combining it with Form Builder isn't too bad at all.