jrmevans
05-15-2003, 02:44 AM
Hi all!!! I hope that someone will have some suggestions on what I could do with something that I am working one.
I have two combo boxes. (see link below). In the first box I have the catagories that I would like to choose. In the second box I have some options for each of the catagories.
What I am looking for is have the options in the second box "post" to the text box above. But I don't want them to clear out till I clear the text box with a button. At this time I am trying to figure out how to post to the text box first. Then I will work on the clearing it out aftwards.
If anyone has any suggestions I would be very grateful.
Thanks all in advance.
James
Combo Boxes (http://members.shaw.ca/jrmevans/codingforums/combo.htm)
cheesebagpipe
05-15-2003, 08:09 AM
James...
Not sure I follow ya', but I felt like working on my typing skills...
<html>
<head>
<title>nothing</title>
<script type="text/javascript" language="javascript">
var optgroups = new Object();
optgroups['Connection Issues'] = [
'New Modem.' ,
'New Computer.' ,
'Ran connection wizard.' ,
'Sub has no connection.' ,
'Modem in standby.' ,
'Powercycled cable modem.' ,
'Has block sync.' ,
'Rebooted computer.' ,
'Computer pingable now.' ,
'Pressed Power/Standby button.' ,
'Modem online now.' ,
'Sub is online.'
]
optgroups['Advanced Issues'] = [
'Modem in standby.' ,
'Valid IP address.' ,
'Invalid IP address.' ,
'192 IP address.' ,
'169 IP address.' ,
'Release/Renew IP.' ,
'Renew successful.' ,
'Ran XP Repair tool.' ,
'Error Renewing Adapter.' ,
'Checked Device Manager.' ,
'Re-installed Drivers.' ,
'Did placeholder/modem swap.' ,
'Intermitant Connection.' ,
'Did trace route.' ,
'150+ms times.' ,
'Packet loss.'
]
optgroups['Registration Issues'] = [
'New Install.' ,
'VT CD not working.' ,
'Set Proxies.' ,
'Registered in Sas.' ,
'Removed proxies.' ,
'Sub is online.' ,
'Set up OE for E-mail.'
]
optgroups['Email Issues'] = [
'Setup OE.' ,
'Reset OE settings.' ,
'Reset password.' ,
'Sent to website.' ,
'Sent to member services.' ,//100
'Migration Issues.' ,
'Collision.' ,
'Reset username.' ,
'Sub upset.'
]
optgroups['Billing Issues'] = [
'Soft Disco.' ,
'Hard Disco.' ,
'Received CC Payment.' ,
'Restored service.' ,
'Promotion not recceived.' ,
'Gave fax Number.'
]
optgroups['Resolutions'] = [
'Sub is Irate.' ,
'Sub is online.' ,
'Outage in area.' ,
'Restored service.' ,
'Scheduled T/C for:' ,
'NO TTS.'
]
optgroups['Hosting'] = [
'Main index","http://www.simplythebest.net/hosting/' ,
'Virtual hosting","http://www.simplythebest.net/hosting/'
]
function populate(oSelect) {
var v = oSelect.options[oSelect.selectedIndex].value; //selected value
if (optgroups[v]) { //plug in to optgroups object for array
var grouplen = optgroups[v].length, dest_sel = document.f2.m2;
dest_sel.options.length = 0; //empty select
dest_sel.size = grouplen; //resize it
for (var newopt,i=0; i<grouplen; ++i) { //fill it
newopt = new Option(optgroups[v][i],optgroups[v][i]);
dest_sel.options[dest_sel.options.length] = newopt;
}
}
return true;
}
function to_textarea(oSelect) {
var opt, i = 0, textarea = document.getElementById('notes');
while (opt = oSelect.options[i++]) //loop
if (opt.selected && textarea.value.indexOf(opt.value) == -1) //option chosen, not in textarea yet
textarea.value += opt.value + '\n'; //put it there, add linefeed
return true;
}
</script>
</head>
<body>
<form>
<TEXTAREA class=formfield2 name="notes" id="notes" rows=12 cols=56 wrap="virtual"></TEXTAREA>
<input type="button" value="clear" onclick="if (confirm('Clear the field?'))notes.value=''">
</form>
<table border=0 cellpadding="3" cellspacing="0" width="100%">
<tr valign=top>
<td align="center" width="175">
<p align="left"><font face="Arial, Helvetica, sans-serif"><b>Category:</b></font></p>
</td>
<td align="left">
<p align="left"><font face="Arial, Helvetica, sans-serif"><b>Link:</b></font></p>
</td>
</tr>
<tr>
<td valign="top" align="left" width="175">
<form name=f1 method=post action="" onSubmit="return false;">
<select name=m1 size="8" onchange="populate(this)">
<option value="Connection Issues">Connection Issues</option>
<option value="Advanced Issues">Advanced Issues</option>
<option value="Registration Issues">Registration Issues</option>
<option value="Email Issues">Email Issues</option>
<option value="Billing Issues">Billing Issues</option>
<option value="Resolutions">Resolutions</option>
<option value="Hosting">Hosting</option>
</select>
</form>
</td>
<td valign="top" align="left">
<form name=f2 method=post action="" onSubmit="return false;" >
<p align="left">
<select name="m2" size="8" multiple="multiple" onchange="return to_textarea(this)">
<option value="/" selected>--- Select a Category ---
</select>
</form>
</td>
</tr>
</table>
</body>
</html>
jrmevans
05-15-2003, 12:56 PM
SWWWEEAAAATTTTT!!!! That is *!!EXACTLY!!* what I have looking for. Awesome. Thanks soooo much....cheesebagpipe
now I just have to intergate it in with my original application....
thanks agian cheesebagpie.
James
jrmevans
05-16-2003, 12:56 PM
Okay, Thanks again cheese for the above information. IT works very very very well.
My next question,
is there any way to "lock" the combo boxes, instead of having the boxes adjust to the size of the content inside.....
Any suggesstion would be appreciated.
James
cheesebagpipe
05-16-2003, 03:42 PM
You're welcome. :)
Just remove this:
dest_sel.size = grouplen; //resize it
jrmevans
05-16-2003, 03:45 PM
Thanks cheese, very very much. I reallly appreciate your input. you have helped my emensely...
james
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.