Hi all,
I have the following code which populates Box2 with values dependant on the option selected in box1. e.g. if user selects “USD” in box1 then box2 populated with “HKD”, “EUR”, if user selects “GBP” in box1 then box2 populated with “IDO”, “AUD”…Code is as follows:
[CODE]function setOptions(o){
var ccy2 = document.predealform.ccy2;
ccy2.options.length = 0;
if (o == “USD”){
ccy2.options[ccy2.options.length] = new Option(‘HKD’);
ccy2.options[ccy2.options.length] = new Option(‘EUR’);}
if (o == “GBP”){
ccy2.options[ccy2.options.length] = new Option(‘IDO’);
ccy2.options[ccy2.options.length] = new Option(‘AUD’);}
}
Once this code has run the user submits the form. What I need is to repopulate box1 and box2 with the values submitted, for it to be remembered.
I rerun the above function so box1 & box2 represent values allowed. It seems to reload and show value selected in box1 & box2 populates with correct values (dependant on box1 selected) but the box2 value shows the first option created using new Option(“”) rather than the one selected.
I do have access to the var which represents the box2 option selected so what I need is a way of creating a new Option which is equivalent to the value of box2 selected…
Any help much appreciated,