Two questions regarding select boxes on forms

  1. I would like to have a multiline select box. I DO NOT mean a “multiselect” box (which allows multiple selections), but a single-item select box that looks like the “multiselect” box, i.e. that does NOT drop down but displays multiple rows.

  2. I have two just select boxes on a form (currently, while I wait to sort out (1) above, I am using multiselect boxes). The contents of the second rely on the selection of the first. Unfortunately there is no “onClick” or “onSelect” even to refill the second box based on the selection of the first. I have to select something in the first box, and then only when I click inside the second box to I get a "form.attachEvent(“onChange)” event with which I can repopulate the second box

  3. I have noticed that using normal select boxes there is no “onChange” event. The event does NOT get triggered when the selection of a normal select box changes!

Hi

  1. after form init
    myForm.getSelect(name).size = 3;

  2. attach event and reload opts manualy
    myForm.attachEvent(“onChange”, function(name, value){
    if (name == “select_1_name”) {
    var opts = myForm.getOptions(“select_2”); // will return dom options element
    // and reload, for example:
    opts.add(new Option(1,“one”));
    }
    })

  3. please provide completed demo to reproduce issue

Thank you Andrei for your kind response.

  1. Works perfectly, thank you…

  2. unfortunately doesn’t work:

for type:‘select’ , “onChange” event doesn’t trigger at all,

for type:‘multiselect’, “onChange” only triggers AFTER you have exited the multiselect box and clicked on something else, which, in my case, is the second select box!

inside form “onChange” triggered from “blur”.
if you need event while focus on select, you can:
var sel = myForm.getSelect(name);
if (window.addEventListener) {
sel.addEventListener(…);
} else {
sel.attachEvent(…);
}