Using Dropdown as a fancy form field
Not before time, I've updated my Dropdown plugin for jQuery. It now supports a new 'form field' mode, meaning you can use Dropdown as a fancy alternative to a element, rather than just as a navigation tool.
As you'd expect of a real , it submits a value to the server once the form is submitted.
It does this by creating a hidden field, whose value is updated every time an 'option' in the dropdown is selected. The name of this hidden field (i.e. the name of the value that should be sent to the server on submit) is denoted a parameter at set-up. Here's an example of using Dropdown in form field mode:
1new Dropdown({
2 mode: 'form',
3 data: [{val: 1, text: 'dog'}, {val: 2, text: 'cat'}, {val: 3, text: 'platipus'}],
4 startText: 'Select an option...',
5 fieldName: 'animal'
6});
Head over here to download, get usage info or view a demo.
post a commentRound-up: IE6 radio bug; updated Dropdown...
First up, thanks to Gerard Okono, who brought to my attention a bug in IE 6 and 7 whereby radio buttons inserted after the DOM has loaded are apparently uncheckable.
Domscripter, my handy DOM-scripting time-saver, has therefore undergone a fudge to get round this problem, involving using a click event to force the clicked radio button to be checked, at the same time unchecking any previously-checked sibling of the same radio family. See the full fudge here.
Secondly, Dropdown has undergone a bit of a revamp. It now accepts more parameters and you have the option of breaking the links in the drop-down into columns - handy for drop-downs with lots of links. Head over here for full info.
Currently Dropdown is a navigation tool designed for aps, but I'm going to tweak it to be usable in forms, too. Stay posted...
post a commentUI for Postcode Anywhere address look-up
Just posted this in the scripts section. It's a user interface for the popular and very useful Postcode Anywhere address look-up service.
They seem to like it - they tweeted about it earlier.
Head over here to download, get usage info or view a demo.
The focus, as ever, is on integration. You set a few config vars, call the script into your page and that's it. You even need to prepare any elements; the look-up link or button is DOM-scripted into your page next to your postcode field, while returned addresses are displayed as links in a neat scrolling Ah, AJAX. From cleaning product to elegant means of sending and retrieving data without clunky page loads. There were those of us who, before AJAX came along, used to route forms through hidden iframes to achieve a similar effect. But re-wiring your forms to go via AJAX can be time-consuming and tough, so I've just posted Ajaxify, which does it for you. Head over here to download, get usage info or view a demo. It acts on any form that has a class in the following format. The part after the hyphen is the name of an optional callback function to which the AJAX response is passed: class='ajaxify-mycallback' The only snag is it doesn't presently support file uploads, since there remains no way (or at least no way without a lot of fudge) to do thise in AJAX. I'll soon be modifying it, though, to route file uploads as a separate request through a DOM-scripted, hidden iframe.Ajaxify - re-route your forms via AJAX
Hello, world
I'm a London-based Javascript specialist, focussing on native JS, jQuery, XSL and related technologies.
Latest content
My projects/writings
XMLPlayground.com - a sandbox for XML development, including (E)XSLT, XQuery, DTD, Schema and more
- Ten Oddities and Secrets of JavaScript
- Commonly Confused Bits of jQuery
- Image Manipulation with jQuery and PHP-GD
- Get Serious with JavaScript: Learn RegExp (in print copies only)
- Catching Up with jQuery's Newer Versions (submitted for print...)
Archive
-
2012
-
Aug
-
Jul
-
Jun
-
May
-
Apr
-
Mar
-
Feb
-
Jan
-
-
2011
-
Dec
-
Nov
-
Oct
-
Sep
-
Aug
-
Jul
-
Jun
-
May
-
Apr
-
Mar
-
Feb
-
Jan
-
-
2010
-
Dec
- >
-
Nov
-
Oct
-
Sep
-
Aug
-
Jul
-
Jun
- > How to: get the node index of an element
- > Match elements via REGEXP in jQuery
- > GD barchart generator
- > Table sort - now REGEXP friendly
- > UI for Postcode Anywhere address look-up
- > Animated table sort
- > Ajaxify - re-route your forms via AJAX
- > curveMe - cross-browser curvy corners
- > Calculate time between two dates
-
May
-
Other stuff, er...
...I lead front-end development at London-based Espresso Education. More info...
...I'm part of the O'Reilly Blogger Review Scheme