...

View Full Version : multi combo boxes doing something weird...



theexo51
07-05-2005, 03:52 PM
can anyone tell me why after i select the option from my third combo box it automatically takes me to a file and folders tasks window? i want it to move to a text box really but i havent added that in yet...

var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}

function redirect2(z){
window.location=temp1[z].value
}


hopefully its in that bit somewhere, but im not 100% sure :confused:

martin_narg
07-05-2005, 04:12 PM
var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}

function redirect2(z){
//window.location=temp1[z].value
alert(temp1[z].value)
}


the top line in bold has been commented out (the //), the bottom line simply uses whatever the final value is and alerts it. Should you wish to input this into a form element, you could change that second bold line to:


document.yourFormName.yourElementName.value = temp1[z].value;


hope this helps

theexo51
07-05-2005, 04:22 PM
cheers, thats what im after.

however, i know the form name, but, here is my nooby bit, whats the elementName. ideally, after selecting the final option i want the focus to go to a text box so i can start typing without using the mouse to click on the box....

thanks dude

EDIT: PS love the sig :P

martin_narg
07-05-2005, 04:30 PM
well that part's up to you mate - you can create your own form such as this:


<form name="myForm" method="post">
<input type="text" name="myTextInput" size="40">
</form>


and then in the code change the relevant line to:



document.myForm.myTextInput.value = temp1[z].value;
document.myForm.myTextInput.focus();


Hope this helps

Tommy Cooper's wicked - I still love Spike Milligans gravestone tho - it just says "I told you I was ill"

m_n

theexo51
07-05-2005, 04:33 PM
spot on! cheers...

PS my headstone is going to say

James Hunt - Buried Alive

theexo51
07-05-2005, 04:55 PM
next logical step...

so i select the data from the combo boxes, then type in any extra data. i now want to press submit and save the data from these boxes and text box onto a new page as a link, so that i can click on it and it will bring up the information.

all of this is so far above my head its making feel dizzy! but im getting there with a little help :D

thanks in advance



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum