Well since both cwhatley and myself had the same problem, and no one was able to come up with a solution... I came up with a workaround :)
Rather than having the multi select box create a multi select box, I made it create a drop down list. Then I wrote a javascript that would allow me to select something from the list, and add it to a textarea, and it
works for multiple entries IN CONJUCTION with the file upload mod!.
Check it out:
Edit your db.cgi, I changed the name of the subroutine to build_limited_multiple_select_field_from_other_db, I would suggest doing this to make things easier to distinguish, then change the subroutine where it outputs, to the following:
Code:
$output = qq|<SELECT NAME="s1"><OPTION>-None-|;
foreach $field (sort @selectfields) {
$selected = 0;
foreach $value (@values) {
if ($value eq $field) {
$output .= "<OPTION SELECTED>$field";
$selected = 1;
}
}
unless ($selected) {
$output .= "<OPTION>$field";
}
}
$output .= "</SELECT>";
return $output;
}
In the html_add_form of your html.pl add the following javascript somewhere between the <head> and </head> *REMEMBER TO CHANGE FIELDNAME*:
<SCRIPT LANGUAGE="JavaScript">
function additive(f,s,t,n) {
document.forms['javaform'].elements['
FieldName'].value += document.forms['javaform'].elements['s1'].options[document.forms['javaform'].elements['s1'].selectedIndex].text + "\\n";
}
</SCRIPT>
In the same html.pl just below the head you should see the form statement, change it to this:
Code:
<FORM action="$db_script_url" method="POST" ENCTYPE="multipart/form-data" NAME="javaform">
insert this in your html_record_form of your html.pl, wherever you want it to appear (change "FieldName" to the name of the field you will be adding to):
Code:
|; print &build_limited_multiple_select_field_from_other_db("FieldName",$rec{'FieldName'});
print qq|<INPUT TYPE="button" VALUE="Add" ONCLICK="additive(1,1,1,1)"><BR>
<TEXTAREA NAME="FieldName" COLS="50" ROWS="10">$rec{'FieldName'}</TEXTAREA>
One last thing, make sure you have your FieldName defined properly in the default.cfg, should be something like this:
Code:
FieldName => [1, 'alpha', '40x3', 1000, 0, '', ''],
Now log back into your DB (hopefully no errors :) and try to add something... make sure theres some entries in the database you are pulling from to generate the drop down menu! Let me know how it goes, it works for me.
Majid Manzarpour
Digital Syncronos