select options request parameter

Forums » Opera for Windows/Mac/Linux » Opera browser

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

11. May 2010, 10:22:02

operaproblems

Posts: 1

select options request parameter

Hi, i am new to forum and Opera. I am also web developer, middle/backend tier.

Opera 9.62 and all other browsers work OK.
Opera 10.53 i am having real problems with.

I have two select boxes. I add same "onchange" function on both boxes. When page is loaded i fill both boxes with this same function.

<select name="mySelectFrom" id="my-select-from"></select>
<select name="mySelectTo" id="my-select-to"></select>



/**
* Puts function on select's onchange
*/
function initMySelectBoxes(){
$(document).bind('ready', function () {
        $('#my-select-from').change(function () {
            fillMySelect('my-select-to, $('#my-select-from').val());
        });
        $('#my-select-to').change(function () {
            fillMySelect('my-select-from', $('#my-select-to').val());
        });
    });

// populate options so user has something to chose from 
fillMySelect('MySelectTo, $('#my-select-from').val());
fillMySelect('MySelectFrom', $('#my-select-to').val());
}

/**
* Repopulates other select box relevant to this select
*/
function fillMySelect(otherSelectBoxID, selectedCode) {
    // if no code selected get map of all avaliable values, otherweise get values relevante to selectedCode
    var selectMap = selectedCode ? getSomeMap(selectedCode) : getAnotherMap();
   
    // now we repopulate select box
    var otherSelectedVal = $('#' + otherSelectBoxID+ '').val();
    $('#' + otherSelectBoxID+ ' option:not(:first)').remove();

    for (var i = 0; i < selectMap.length; i++) {
       // here is where the problem lies
        $('#' + otherSelectBoxID).append('<option value="' + selectMap[i].code + '" title="' + selectMap[i].name + '"' + (selectMap[i].code == otherSelectedVal ?  ' selected="selected"' : '') + '>' + selectMap[i].name + '</option>');
    }
}



After onchange function is executed, in posted url i get ...&my-select-from=&my-select-from=CODE&... so when i try to retrive value on server i get empty String becuse it gets the first value read.

It doesn't matter if i use jQuery or old school code in Opera 10.53 always duplicates parameter.
// this does the same
for(var i = ...){
selectElement.options[i]=new Option(...);

Forums » Opera for Windows/Mac/Linux » Opera browser