I have a problem wtih a javascript that is embedded in a cgi/perl script (DBMan) file: The javascript works, but for some reason, the data is not saved in the database (well, flat file). Here are pertinent snipits of code:
In my Script (sub html_page_top, sub html_error_page_top and sub html_imp_preview):
function init(frm) {
var combo = frm.Select_Box;
var combo2 = frm.Category;
frm.category.value = combo.options[combo.selectedIndex].value;
frm.occupancytype.value = combo2.options[combo2.selectedIndex].value;
}
In my sub html_imp_record_form code:
<SELECT NAME="Select_Box" onChange="fillSelectFromArray(this.form.Category, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">
<OPTION VALUE="-1">Select Category
<OPTION VALUE="Site Improvements-Retaining Wall">Site Improvements - Retaining Wall
<OPTION VALUE="Site Improvements-Culvert">Site Improvements - Culvert
<OPTION VALUE="Site Improvements-Curbing">Site Improvements - Curbing
<OPTION VALUE="Site Improvements-Flagpole">Site Improvements - Flagpole
<OPTION VALUE="Site Improvements-Fencing">Site Improvements - Fencing
<OPTION VALUE="Site Improvements-Grating">Site Improvements - Grating
<OPTION VALUE="Site Improvements-Landscaping">Site Improvements - Landscaping
<OPTION VALUE="Site Improvements-Miscellaneous">Site Improvements - Miscellaneous
<OPTION VALUE="Site Improvements-Parking Lot">Site Improvements - Parking Lot
<OPTION VALUE="Site Improvements-Paving">Site Improvements - Paving
<OPTION VALUE="Site Improvements-Sprinklers">Site Improvements - Sprinklers
<OPTION VALUE="Site Improvements-Stairway/Deck">Site Improvements - Stairway/Deck
<OPTION VALUE="Site Improvements-Swimming Pool">Site Improvements - Swimming Pool
<OPTION VALUE="Site Improvements-Synthetic Surface">Site Improvements - Synthetic Surface
<OPTION VALUE="Site Improvements-Tennis Court">Site Improvements - Tennis Court
<OPTION VALUE="Other">Other
</SELECT><br>
<SELECT NAME="Category" SIZE="1">
<OPTION> </OPTION>
</SELECT></TD></TR>
In my sub html_imp_add_form (and other places) code:
print qq|
<form action="$db_script_url" method="POST" name="form1" onsubmit="init(this)">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="category" value="">
<input type=hidden name="occupancytype" value="">
|;
The following is a link to a test version of the html.pl (named htmimp_pl.txt):
a sample of the working script (outside of DBMan) is at:
I really need help figuring out what I've done that this code no longer writes to the fields in the file. The first select box puts a "-1" in the database, the options list puts nothing in the database -- it was working at one time too! now it's not!
Thanks for your help!
Lynette
In my Script (sub html_page_top, sub html_error_page_top and sub html_imp_preview):
function init(frm) {
var combo = frm.Select_Box;
var combo2 = frm.Category;
frm.category.value = combo.options[combo.selectedIndex].value;
frm.occupancytype.value = combo2.options[combo2.selectedIndex].value;
}
In my sub html_imp_record_form code:
<SELECT NAME="Select_Box" onChange="fillSelectFromArray(this.form.Category, ((this.selectedIndex == -1) ? null : team[this.selectedIndex-1]));">
<OPTION VALUE="-1">Select Category
<OPTION VALUE="Site Improvements-Retaining Wall">Site Improvements - Retaining Wall
<OPTION VALUE="Site Improvements-Culvert">Site Improvements - Culvert
<OPTION VALUE="Site Improvements-Curbing">Site Improvements - Curbing
<OPTION VALUE="Site Improvements-Flagpole">Site Improvements - Flagpole
<OPTION VALUE="Site Improvements-Fencing">Site Improvements - Fencing
<OPTION VALUE="Site Improvements-Grating">Site Improvements - Grating
<OPTION VALUE="Site Improvements-Landscaping">Site Improvements - Landscaping
<OPTION VALUE="Site Improvements-Miscellaneous">Site Improvements - Miscellaneous
<OPTION VALUE="Site Improvements-Parking Lot">Site Improvements - Parking Lot
<OPTION VALUE="Site Improvements-Paving">Site Improvements - Paving
<OPTION VALUE="Site Improvements-Sprinklers">Site Improvements - Sprinklers
<OPTION VALUE="Site Improvements-Stairway/Deck">Site Improvements - Stairway/Deck
<OPTION VALUE="Site Improvements-Swimming Pool">Site Improvements - Swimming Pool
<OPTION VALUE="Site Improvements-Synthetic Surface">Site Improvements - Synthetic Surface
<OPTION VALUE="Site Improvements-Tennis Court">Site Improvements - Tennis Court
<OPTION VALUE="Other">Other
</SELECT><br>
<SELECT NAME="Category" SIZE="1">
<OPTION> </OPTION>
</SELECT></TD></TR>
In my sub html_imp_add_form (and other places) code:
print qq|
<form action="$db_script_url" method="POST" name="form1" onsubmit="init(this)">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
<input type=hidden name="category" value="">
<input type=hidden name="occupancytype" value="">
|;
The following is a link to a test version of the html.pl (named htmimp_pl.txt):
a sample of the working script (outside of DBMan) is at:
I really need help figuring out what I've done that this code no longer writes to the fields in the file. The first select box puts a "-1" in the database, the options list puts nothing in the database -- it was working at one time too! now it's not!
Thanks for your help!
Lynette