Assuming that your version of the CF two selected tag is using the
ChangeMenu function:
<CFSCRIPT>
Variables.FormName = "whateverMyFormNameIs";
Variables.My_Default_Left_ID = 1;
Variables.My_Default_Right_IDs = '2,3,4,5';
</CFSCRIPT>
<HTML>
<HEAD>
<CFOUTPUT><SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
function initPage() {
/* Make sure the leftID is preselected */
var preselected = false;
var selectionObject =
document.#Variables.FormName#.Left_ID;
var tot = selectionObject.length;
for(var i = 0; i#Chr(60)#tot; i++) {
var optionObject = selectionObject.options[i];
var optionValue = optionObject.value;
if(optionValue==#My_Default_Left_ID#) {
optionObject.selected = true;
#Variables.FormName#Left_IDChangeMenu(i);
preselected = true;
/* break so we don't get stuck at the
bottom */
break;
}
else {optionObject.selected = false;}
}
if(preselected == false)
{selectionObject.options[0].selected = true;}
/* Make sure the rightIDs are preselected */
var rightIDArray = new
Array(#Variables.My_Default_Right_IDs#);
preselected = false;
selectionObject =
document.#Variables.FormName#.Right_ID;
tot = selectionObject.length;
for(i = 0; i#Chr(60)#tot; i++) {
optionObject = selectionObject.options[i];
optionValue = optionObject.value;
for(var j = 0; j#Chr(60)#rightIDArray.length;
j++) {
if(optionValue==rightIDArray[j]) {
optionObject.selected = true;
preselected = true;
}
}
}
if(preselected == false)
{selectionObject.options[0].selected = true;}
}
function selectAllRights() {
var tot =
document.#Variables.FormName#.Right_ID.length;
for(var i = 0; i#Chr(60)#tot; i++) {
if(document.#Variables.FormName#.Right_ID.options[i].value!=0) {
document.#Variables.FormName#.Right_ID.options[i].selected = true;
}
else {
document.#Variables.FormName#.Right_ID.options[i].selected = false;
}
}
}
</SCRIPT></CFOUTPUT>
</HEAD>
<BODY
onLoad="initPage();"
><FORM
ACTION="somewhere_else.cfm"
METHOD="post"
NAME="#Variables.FormName#"
><TABLE><TR><TD><CFMODULE
NAME="TwoSelectsRelated"
AUTOSELECTFIRST="Yes"
DEFAULT1="#My_Default_Left_ID#"
DISPLAY1="Left_Name"
DISPLAY2="Right_Name"
FORMNAME="#Variables.FormName#"
HTMLBetween="#Chr(60)#/TD#Chr(62)##Chr(60)#TD VALIGN=""top""
TITLE=""Use
the Ctrl key to select individual rights, use the Shift key to select groups
of rights. Click here to select all rights."" ONCLICK=""selectAllRights()""
onMouseOver=""this.style.cursor = 'hand';"" onMouseOut=""this.style.cursor =
'auto';""#Chr(62)# #Chr(60)#B#Chr(62)#for
these#Chr(60)#BR#Chr(62)#rights#Chr(60)#/B#Chr(62)# #Chr(60)#/TD#Chr(62
)##Chr(60)#TD VALIGN=""middle""#Chr(62)#"
NAME1="Left_ID"
NAME2="Right_ID"
QUERY="GetLeftInnerJoinedWithRight"
SIZE1="5"
SIZE2="5"
VALUE1="Left_ID"
VALUE2="Right_ID"
></TD></TR></TABLE></FORM></BODY>
</HTML>
-----Original Message-----
From: David Boyd [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 04, 2001 6:19 AM
To: CF-Talk
Subject: CF Two Selected TAG
Hi,
Does anyone know how to preselect values using the CF two selected tag?
Cheers.
[snip]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists