[development] Forms API "Widgets", AJAX and non-JavaScript
Rob Thorne
rob at torenware.com
Wed Jan 31 02:24:42 UTC 2007
I've done a couple of projects that needed custom "widgets" to use
within Forms API, something that you might write into code with
something like....
$form['some_text'] = array('#type' => 'textfield', ....);
$form['event_date'] = drupal_widget_date($title, $default,
$options....);
...
I've done stuff like this for CiviCRM objects like contacts and groups,
but the idea of getting these kinds of things into reusable functions
seems pretty attractive, since:
* It makes it fairly simple to implement some kinds of custom
JavaScript widgets transparently.
* You could get consistent "fallback" behavior for non-JavaScript
capable browsers.
* The code is easier to understand, and probably more reliable if
you're doing something unusual.
Has anyone developed anything along this lines? I'm especially
interested in finding easier ways to integrate jquery-type widgets for
more flexible kinds of autocomplete (say, combo-boxes instead of the
simple pop-up select that autocomplete does now), and integrating safer
and saner non-JavaScript behavior to a form field that are more consistent.
I'm not sure if I'm being clear enough here, but do any of you have
ideas similar to this, and how have you implemented them?
Thanks,
Rob
More information about the development
mailing list