Hi All,
Trying to load the options contents from my selection box SelectedAccounts to a variable. I move accounts from AvailAccounts to SelectedAccounts via js code. When I hit submit button, code cycles through each account in the SelectedAccounts select box but does not load variable "output".
HTML Code:
Here is my JavaScript code:
Any help would be appreciated.
TIA,
Tim
Trying to load the options contents from my selection box SelectedAccounts to a variable. I move accounts from AvailAccounts to SelectedAccounts via js code. When I hit submit button, code cycles through each account in the SelectedAccounts select box but does not load variable "output".
HTML Code:
Code:
<SELECT name="AvailAccounts" multiple size="10" style="width:240px;" width="235">
<option>AA Test Inc. [AAB] [123456789]</option>
<option>Demo Company [CTX] [987654321]</option>
<option>BB Text Account [DTD] [333333333]</option>
</SELECT>
<SELECT name="SelectedAccounts" multiple size="10" style="width:240px;" width="235">
</SELECT>
Here is my JavaScript code:
Code:
...
var selAccts = document.forms[frmName].SelectedAccounts.options.length;
if (selAccts == 0) {
alert("Please choose at least one company ID.");
document.forms[frmName].AvailAccounts.focus();
return;
}else {
var output = '';
for (var i=0, l=document.forms[frmName].SelectedAccounts.options.length;i<l;i++) {
alert("i is ... " + i);
if (i == 0) {
output += escape(document.forms[frmName].SelectedAccounts.options[i].value);
alert("output1 is ... " + output);
}else {
output += ',' + escape(document.forms[frmName].SelectedAccounts.options[i].value);
alert("output2 is ... " + output);
}
}
document.forms[frmName].selAccounts.value = output;
output = '';
}
...
Any help would be appreciated.
TIA,
Tim