On Feb 4, 10:41 am, Richie M <i...@linuxbox.co.uk> wrote:
> Hi,
> I have a form with three drop down select boxes in it. I'd like the
> second box to populate when an option is selected in the first, and
> for the third to populate when an option is selected from the second.
> In the first select box, I use onchange to call a php script:
> <select id='box1' onchange="ajaxUpdater('ajax_regions', '/ajax/
> populate.php?show=month&id=' + getsel('box1')">

Apart from the invalid HTML (pointed out by TJ), it is very unwise to
use an onchange handler with a select element if there is any chance
the form will be used in IE.  If a user tries to navigate the options
using the cursor keys in IE, a change event will fire each time the
key is pressed and changes the selected option - I don't think that is
what you want.

I don't know what the getsel function does, however I suspect you are
using the ID attribute inappropriately.  Option elements have a value
attribute[1] that is supposed to be used to send data to the server,
select elements have a DOM value property that is determined from the
selected option, so why not use:

  <select onblur="ajaxUpdater(... + this.value);">
    <option value="value 0">value 0
    <option value="value 1">value 1
    <option value="value 2">value 2

Or use an explicit "update the form" button.

1. The text attribute can be used to, however due to IE's non-
compliance with the W3C standard relating to use of text as the option
value, it is easier to explicitly use the value attribute.

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to