Flash "Slush Box"
Ron Pasch from Prisma-IT has put together a great example of a dual select box, or as some call it a "slush box".
This example connects two
Update: Ray Camden has taken this example updated it and wrapped it up in a custom tag. Download it here
if(lb1.selectedIndices != undefined)
{
var r:Array = lb1.selectedIndices.sort(16|2);
for( var i=0; i<r.length; i++ )
{
lb2.addItem(lb1.getItemAt(r[i]));
lb1.removeItemAt(r[i]);
}
}
</cfsavecontent>
<cfsavecontent variable="selectAll">
var bah:Array = Array();
for(var i=0; i<select1.length; i++)
{
bah[i] = i;
}
select1.selectedIndices = bah;
var bah:Array = Array();
for(var i=0; i<select2.length; i++)
{
bah[i] = i;
}
select2.selectedIndices = bah;
</cfsavecontent>
<cfdump var="#form#">
<cfform format="flash" width="500" onSubmit="#selectAll#">
<cfformgroup type="horizontal">
<cfselect name="select1" width="200" size="10" multiple="Yes">
<option value="1">Sue Hove</option>
<option value="2">Simon Slooten</option>
<option value="3">Ron Pasch</option>
</cfselect>
<cfformgroup type="vertical">
<cfinput type="Button" name="addi" value=">" height="25" width="30" onclick="var lb1=select1;var lb2=select2;#addScript#">
<cfinput type="Button" name="deli" value="<" height="25" width="30" onclick="var lb1=select2;var lb2=select1;#addScript#">
<cfinput type="Button" name="adda" value=">>" height="25" width="30" onclick="var lb1=select1;var lb2=select2;#selectAll##addScript#">
<cfinput type="Button" name="dela" value="<<" height="25" width="30" onclick="var lb1=select2;var lb2=select1;#selectAll##addScript#">
</cfformgroup>
<cfselect name="select2" width="200" size="10" multiple="Yes"></cfselect>
</cfformgroup>
<cfinput type="submit" name="btn" value="Submit">
</cfform>

Now sure you could write AS code to stuff b oth things in 2 hidden fields. That would work. But I'd love to see a solution that is packaged. Ie, I'd like to drop in a custom tag, cf_slush, and not have to worry about adding code to my onSubmit.
Custom Tag could be easily made out of this (as I see raymond already did)
I've also added to the script to disable the form when people click the submit button, to make sure nothing is changed after you submit it and the Post request can just do it's job...
lb2.sortItemsBy("label","ASC");
I wanted to be default selected when item moved from left to right.
The solution is I inserted the following line after line # 62.
#attributes.name#_select2.selectedIndex = i;
and that will move the focus and select the last item moved from left to right.
Not sure what I am doing wrong. If I use the sample above it works, I think maybe its because there are to many records, I am only putting 3-10 records in the select2. So I wouldnt think its a problem with the records. Any thoughts? Oh yeah if I use the shift and pointer I can select all and send the items to the DB just fine, just need the auto select to work. Thanks
http://needfornews.com/feed.php?d=16757
http://docwebnews.com /
http://copydvdworld.com/
http://qualitydrugstore.biz/product_silagra.htm
http://qualitydrugstore.biz/product_florinef.htm
http://qualitydrugstore.biz/product_actos.htm
http://qualitydrugstore.biz/product_deltasone.htm
http://qualitydrugstore.biz/product_singulair.htm
http://qualitydrugstore.biz/product_tenormin.htm
interesting site
http://cheapnewsguide.com