/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Tough one ….Dropdown value not getting set in Opera !!

Hi,
I am using XMLHTTPREQUEST to get make server calls to get data for the typical car (year,make,model) dropdwon for a find car listing website.

Depending on the year selected i make a server call using xmlhttprequest for getting the car make list and when the user select the make i make a server call to get a model list …
( i am using xmlhttprequest for avoiding the problem of complete page refresh)

Now the prob……
This code works fine in all the browser but Opera …

When I come to the page I select the year ..it make the server call and i get the make list …..but when i try to make the server call for getting the model list for the make selected ..i am not getting the make value form the make drop down …
I am using html:select html:options for all the 3 drop downs …..

i am calling a dropdown on_change method for the server call passing “this” parameter to access the dropdown value

on_change(this);
on_change(lb){
var model = lb.value;
server call using model;
}

same method is use for the year dropdown which works fine …..but when i make a selection in the make dropdown ….lb.value is blank ….:-(

I hope i have explain the suitation ……

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 29.2006 — This is techincally improper syntax for a SELECT:

var model = lb.value;

Try this:

var model = lb.options[lb.selectedIndex].value;

This, of course, is true as long as the SELECT is not defined with the MULTIPLE attribute. Oh, also, if the OPTION has no VALUE, perhaps Opera won't default the TEXT into the VALUE for you. I've never tried Opera. ?
Copy linkTweet thisAlerts:
@smartvishauthorMar 29.2006 — This is techincally improper syntax for a SELECT:

var model = lb.value;

Try this:

var model = lb.options[lb.selectedIndex].value;

This, of course, is true as long as the SELECT is not defined with the MULTIPLE attribute. Oh, also, if the OPTION has no VALUE, perhaps Opera won't default the TEXT into the VALUE for you. I've never tried Opera. ?[/QUOTE]


I have tried the code that you mentioned ...doesnt works :-(
Copy linkTweet thisAlerts:
@smartvishauthorMar 30.2006 — I used lb.options[selectedIndex].text .....instead ...works in all browser ....:-)
×

Success!

Help @smartvish spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...