By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Automatic selection of <OPTION> after info sent to form

P: 3
Hello there,

I've got a few dropdown 'SELECT' controls on a page that represent the days months and years. A little popup calendar will send back the day month and year and insert them into a text box with no problems.

But I want the drop down menus to have their selected values changed using javascript.

Is this possible anyone?

Thanks

Adrian.
Mar 7 '08 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
Yes, set the value of each select drop-down as required.

Make sure that each option has a value otherwise this won't work in IE.
Mar 7 '08 #2

P: 3
Yes, set the value of each select drop-down as required.

Make sure that each option has a value otherwise this won't work in IE.
Think you've missed the point. I want the 'SELECT' drop down to highlight the matching value to the value that is sent from the calendar javascript.

So if Month is sent in as "March" then the option :

<option value='March'>March</option>

will be selected.
Mar 7 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Let's say you have a select with ID "month", then the following should work:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("month").value = calMonth;
  2. // where calMonth is the month sent from the calendar
Mar 7 '08 #4

P: 3
Thanks all,

the :
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("month").value = calMonth;
doesn't work with the drop down menu's it appears.
Mar 13 '08 #5

acoder
Expert Mod 15k+
P: 16,027
Can you post some code or a test link.
Mar 13 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.