473,396 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Automatic selection of <OPTION> after info sent to form

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
5 1331
acoder
16,027 Expert Mod 8TB
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
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
16,027 Expert Mod 8TB
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
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
16,027 Expert Mod 8TB
Can you post some code or a test link.
Mar 13 '08 #6

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

Similar topics

1
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php...
1
by: Robert Kattke | last post by:
I'm designing a site for local music and entertertainment and have a few ?s that need to be cleared up. Currently, I'm working on the Club part and have a Contact Person form, and a Club form. ...
2
by: LC's No-Spam Newsreading account | last post by:
I have a form arranged in a table (you can see an example in the page http://cosmos.mi.iasf.cnr.it/~lssadmin/Website/LSS/Help/query.html) The table is on three columns but has a structure like...
2
by: Craig Keightley | last post by:
How do I retrive the Name of the item in a select box I have the following form <select name="select"> <option value="1">Monday</option> <option value="2">Tuesday</option> <option...
6
by: Chris Fink | last post by:
Does anyone know it is possible to include a small image(.gif .jpeg) within a <SELECT><option> so that the user would see the option text as well as a little image(icon) in the option? I know this...
6
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works...
5
by: Cylix | last post by:
My code works under MS IE6, but not work on Firefox and Mac IE5.1.2 Mac IE5.1.2 response: 'options' is not an object function to check leap year Source code:...
9
by: Man-wai Chang | last post by:
For a form POST, what's the difference between: 1. <option</option> 2. <option>&nbsp;</option> -- iTech Consulting Services Limited Expert in ePOS (Point-Of-Sales) solutions Website:...
14
by: The Natural Philosopher | last post by:
This is a nasty one and I can't see my way out of it. I have a bunch of select statements in a form, and each select statement has an onchange="do_something(this)" in it, and this works...
14
mikek12004
by: mikek12004 | last post by:
In a form I have 5 elements (e.g. pictures) and I wish for the user to be able to set the order of appearance. For this I have for each picture a select box (names select1 to select5) with "please...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.