• Get droplist index value by name?

    From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Thu Oct 14 23:41:13 2021
    I have a dropdown "select option list" holding midi portIDs.
    So reading the dropdown i know the name of available midiports.

    I can visualy inspect to know the index of the ID i want.

    But how can i use the ID to retrieve the index? ctrlportindex=parent.document.getElementById("parent.out_portsel").value // "FW1884 Control"

    It is the the index of the Id of element out_portsel i am looking for?

    Maybe i am doing it backward but i use the index to select output port.
    In this case i know the "id" i want, but want is its index in the dropdownlist?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Thu Oct 14 23:49:41 2021
    fredag 15 oktober 2021 kl. 08:47:50 UTC+2 skrev Jonas Thörnvall:
    fredag 15 oktober 2021 kl. 08:41:19 UTC+2 skrev Jonas Thörnvall:
    I have a dropdown "select option list" holding midi portIDs.
    So reading the dropdown i know the name of available midiports.

    I can visualy inspect to know the index of the ID i want.

    But how can i use the ID to retrieve the index? ctrlportindex=parent.document.getElementById("parent.out_portsel").value // "FW1884 Control"

    It is the the index of the Id of element out_portsel i am looking for?

    Maybe i am doing it backward but i use the index to select output port.
    In this case i know the "id" i want, but want is its index in the dropdownlist?
    I could probably loop through the id's equal to "x" and read out the index by loop counter.
    But it seem a "A BIT IDIOTIC" if there already is a function for retrieving it.
    I give it 30 minutes "then i am going idiotic"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Thu Oct 14 23:47:45 2021
    fredag 15 oktober 2021 kl. 08:41:19 UTC+2 skrev Jonas Thörnvall:
    I have a dropdown "select option list" holding midi portIDs.
    So reading the dropdown i know the name of available midiports.

    I can visualy inspect to know the index of the ID i want.

    But how can i use the ID to retrieve the index? ctrlportindex=parent.document.getElementById("parent.out_portsel").value // "FW1884 Control"

    It is the the index of the Id of element out_portsel i am looking for?

    Maybe i am doing it backward but i use the index to select output port.
    In this case i know the "id" i want, but want is its index in the dropdownlist?
    I could probably loop through the id's equal to "x" and read out the index by loop counter.
    But it seem a "A BIT IDIOTIC" if there already is a function for retrieving it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Jonas_Th=C3=B6rnvall?=@21:1/5 to All on Fri Oct 15 00:18:36 2021
    fredag 15 oktober 2021 kl. 08:49:46 UTC+2 skrev Jonas Thörnvall:
    fredag 15 oktober 2021 kl. 08:47:50 UTC+2 skrev Jonas Thörnvall:
    fredag 15 oktober 2021 kl. 08:41:19 UTC+2 skrev Jonas Thörnvall:
    I have a dropdown "select option list" holding midi portIDs.
    So reading the dropdown i know the name of available midiports.

    I can visualy inspect to know the index of the ID i want.

    But how can i use the ID to retrieve the index? ctrlportindex=parent.document.getElementById("parent.out_portsel").value // "FW1884 Control"

    It is the the index of the Id of element out_portsel i am looking for?

    Maybe i am doing it backward but i use the index to select output port. In this case i know the "id" i want, but want is its index in the dropdownlist?
    I could probably loop through the id's equal to "x" and read out the index by loop counter.
    But it seem a "A BIT IDIOTIC" if there already is a function for retrieving it.
    I give it 30 minutes "then i am going idiotic"
    Ok this is how it ended up.

    function getPortIndex(){
    var e = parent.document.getElementById("out_portsel");
    for (var i=0;i<parent.out_portsel.length;i++){
    if (e.options[i].value=="FW1884 Control"){ctrlportindex=i; break;};
    }
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)