Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Select List insert into DB
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

The Omega
New Member

55 Posts

Posted - 07 January 2005 :  12:56:32  Show Profile
I have a select list that doesnt want to behave. The left side willbe/is generated by the database and the right side is the insert field. The select list works properly and I can switch it from one list to the other. However, when I go to submit the form it does not accept the items in the right list unless I manually select them and then press submit.

I have tried to use a highlight text script like used for textboxes but it doesnt work on the select boxes

Select List:
"<td colspan=""1"">" & vbNewLine & _
"Recipients: <br/>" & vbNewLine & _
"<select multiple size=""5"" name=""list1"" style=""width:100"">" & vbNewLine & _
"<option value=""1"">Ben Smith</option>" & vbNewLine & _
"<option value=""D"">Dispatch</option>" & vbNewLine & _
"<option value=""V"">Dev</option>" & vbNewLine & _
"</SELECT>" & vbNewLine & _
"</td>" & vbNewLine & _
"<td>" & vbNewLine & _
"<input type=""button"" onClick=""move(this.form.frmMemoRecipients,this.form.list1)"" value=""<<"">" & vbNewLine & _
"<input type=""button"" onClick=""move(this.form.list1,this.form.frmMemoRecipients)"" value="">>"">" & vbNewLine & _
"</td>" & vbNewLine & _
"<td>" & vbNewLine & _
"<br/>" & vbNewLine & _
"<select multiple size=""5"" name=""frmMemoRecipients"" style=""width:100"">" & vbNewLine & _
"</select>" & vbNewLine & _
"</td>" & vbNewLine & _
"</tr>" & vbNewLine & _
"<tr>" & vbNewLine & _
"<td colspan=""4"" valign=""top"" align=""right"">" & vbNewLine & _
"<input onClick=""selectText()"" type=""Submit"" Value=""Submit"" Name=""Submit"">" & vbNewLine & _
"</td>" & vbNewLine & _
"</tr>" & vbNewLine & _

Move & Highlight Javascript
function move(fbox, tbox) {
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }
}
//  End -->
</SCRIPT>
 <script>
 // Copyright 2001 by www.CodeBelly.com
 // Do *not* remove this notice.
 function selectText(){
 document.memoform.frmMemoRecipients.focus();
 document.memoform.frmMemoRecipients.select();
 }
 </script>

The Omega
New Member

55 Posts

Posted - 12 January 2005 :  14:15:21  Show Profile
<script language="JavaScript"> 
function selectAllOptions(obj) {
	for (var i=0; i<obj.options.length; i++) {
		obj.options[i].selected = true;
		}
	}
 </script>


onClick=""selectAllOptions(document.memoform.frmMemoRecipients)""


I did a bit more searching and finally remembered that Snitz already had the script that I needed in the allowed members assignment area.... hence the solution above....
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.45 seconds. Powered By: Snitz Forums 2000 Version 3.4.07