Click to See Complete Forum and Search --> : combox box selection
aamirc
06-20-2003, 09:13 AM
Greetings...
This is my first message to the forum.
I have five combo boxes on the same page. All of them contain the values 1 to 5. Upon selecting any one of the values in a combo box the other combo boxes should not display that value. For instance if '1' is slected in the first combo box and '4' in the second then the rest should only display values '2','3' and '5'.
How or where can i can the sciprt to do this for me.
regards
Aamir Suleman
anarchist
06-20-2003, 09:25 AM
do you need this to remove the options from all the other combos? just the ones after, or make it impossable to select that option?
as I can see problems with taking off all as once youve made your selections if you cahnge your mind you wont be able to change select anything as the options will all be gone
maybe a better way would be to use the onchange event to make sure that number hasnt already been selected in the other boxes and then using an alert or confirm to tell the user thats not alowed?
Gopinath
06-20-2003, 09:37 AM
On change event of the fourth combo
from name="frm1"
for(var int_count=0; int_count<5; int_count++)
{
Gopinath
06-20-2003, 09:42 AM
On change event of the fourth combo
from name="frm1"
for(var int_count=0; int_count<5; int_count++)
{
if((document.frm1.cmb2.options[int_count].value!=
document.frm1.cmb1.options[int_count].value!=) &&
(document.frm1.cmb2.options[int_count].value!=
document.frm1.cmb4.options[int_count].value!=))
{
document.getElementById("cmb2").selectedIndex= int_count
}for(var int_count=0; int_count<5; int_count++)
{
if((document.frm1.cmb3.options[int_count].value!=
document.frm1.cmb1.options[int_count].value!=) &&
(document.frm1.cmb3.options[int_count].value!=
document.frm1.cmb2.options[int_count].value!=)&&(document.frm1.cmb3.options[int_count].value!=
document.frm1.cmb4.options[int_count].value!=))
{
document.getElementById("cmb3").selectedIndex= int_count
}
for(var int_count=0; int_count<5; int_count++)
{
if((document.frm1.cmb5.options[int_count].value!=
document.frm1.cmb1.options[int_count].value!=) &&
(document.frm1.cmb5.options[int_count].value!=
document.frm1.cmb2.options[int_count].value!=)&&(document.frm1.cmb5.options[int_count].value!=
document.frm1.cmb3.options[int_count].value!=) &&
(document.frm1.cmb5.options[int_count].value!=
document.frm1.cmb4.options[int_count].value!=))
{
document.getElementById("cmb5").selectedIndex= int_count
}
check it and send the response
aamirc
06-20-2003, 09:44 AM
if the user selects '4' then the other combo boxes should not provide '4' as an option and if the user changes his mind and chnages his selection to '1' then the other combo boxes should display the rest including '4'. can i get this script from any web site?
aamirc
06-20-2003, 09:48 AM
actually gopinathan my values would be strings and not integers. like 'tom','peter','aamir','mukesh','samir'