Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syncing Select boxes

Status
Not open for further replies.

mweinstock

IS-IT--Management
Oct 21, 2002
66
US
I've got a page with three "SELECT" elements. I need three distinct columns, which is why I'm using three elements. But all the data is related. Item 4 in element 1 is related to item 4 in element 2 and 3. I'd like to find a way to scroll the three select boxes together. That is, if I grab the scroll bar on the first box and scroll down, the other two scroll as well.

Alternatively, if there's a way to put it all in one select box, and have the data still show up in three columns (where I can put in column headers), that would be great too.

Thanks.

Mark

--
How can you be in two places at once when you're not anywhere at all?
 
Hi.

I created a test html page to show you how this can work.

Create a new html page and paste the entire code below:

Code:
<html>
<head>
	<title>Changing Three Columns Based On Select Box</title>
	<script language="javascript">
	<!--
		function splitAndPrint() {
			var the_text = document.the_form.sel_box.value;
			var the_array = the_text.split("/");
			
			//update column headers
			document.getElementById('colOneHeader').innerHTML = the_array[0];
			document.getElementById('colTwoHeader').innerHTML = the_array[1];
			document.getElementById('colThreeHeader').innerHTML = the_array[2];
		}
	-->
	</script>
</head>

<body>
<form name="the_form">
<select name="sel_box" onchange="splitAndPrint()">
	<option value="one/two/three" SELECTED>one/two/three</option>
	<option value="a/b/c">a/b/c</option>
	<option value="stuff/things/junk">stuff/things/junk</option>
</select>
</form><br><br><br>

<table border="1" width="400">
<th id="colOneHeader">default 1</th>
<th id="colTwoHeader">default 2</th>
<th id="colThreeHeader">default 3</th>
</table>

</body>
</html>

Does this help you at all?

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Thanks, but actually, what I need is to have one or three select boxes (say, size 10), where if I scroll the first box, the other two boxes scroll with it.

I have three data items. Right now they are in three different select boxes (two of which are disabled).

Here's what the code looks like right now
[tt]
<FORM NAME="IMAP-CC" METHOD="POST" ACTION="/merci/imap-cc.php">
<INPUT TYPE="HIDDEN" NAME="source" VALUE="/merci/imap-cc.php" />
<TABLE border-"0">
<TR>
<TD>IP Address</TD>
<TD>Allow</TD>
<TD>Refuse</TD>
</TR>
<TR><TD><SELECT SIZE="10" NAME="ip"><OPTION VALUE="0">127.0.0.1-127.255.255.1
</OPTION><OPTION VALUE="1">0.0.0.0-255.255.255.255
</OPTION></SELECT></TD><TD><SELECT SIZE="10" NAME="allow" DISABLED><OPTION>&nbsp;&nbsp;&nbsp;&copy</OPTION><OPTION> </OPTION></SELECT></TD><TD><SELECT SIZE="10" NAME="refuse" DISABLED><OPTION> </OPTION><OPTION>&nbsp;&nbsp;&nbsp;&copy</OPTION></SELECT></TD><TR></TABLE>
<BR>
<INPUT TYPE="BUTTON" NAME="add" VALUE="Add Restriction" onClick="javascript:mod_acl('','add',this.form.source.value);" />
<INPUT TYPE="BUTTON" NAME="change" VALUE="Change Selection" onClick="javascript:mod_acl(this.form.ip.value,'change',this.form.source.value);" />
<INPUT TYPE="SUBMIT" NAME="delete" VALUE="Remove Selection" />
</FORM>
[/tt]
I want to scroll the boxes together, or somehow get all three data items in one box, where I can still have headers for them.

--
How can you be in two places at once when you're not anywhere at all?
 

Sorry - I should clarify that answer.

I don't believe you can do what you're asking with standard select boxes.

If you want to write your own select box code using DHTML, then you might be able to fake it, however.

Hope this helps,
Dan
 
Thanks. I figured that was the case, but was hoping for some creative workaround. I guess I'll figure out a way to do it with tables and an IFRAME.

--
How can you be in two places at once when you're not anywhere at all?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top