I didn't find the thread Eliot pointed to by using his search terms, so I'll tell you what I did.
In sub html_record_form, I have:
<TR><TD align=right valign=top><$font>Category:</font></td>
<TD>|; print &build_select_field_from_db("Category",$rec{'Category'});
if ($per_admin) {
print qq|<BR><input type=text name="Category" size="20" maxlength="255">
<$font>Add a new category</font></td></tr>|;
}
print qq|
You'll also need to make a change in sub validate_record. Add the code in red below:
foreach $col (@db_cols) {
$in{$col} =~ s/^~~//;
$in{$col} =~ s/~~$//;
if ($in{$col} =~ /^\s*$/) { # entry is null or only whitespace
if ($db_not_null{$col}) { # entry is not allowed to be null.
push(@input_err, "$col (Can't be Blank)"); # so let's add it as an error
}
}
If you don't add those lines, you'll end up with a ~~ at either the beginning or end of your field entry.
JPD
http://www.jpdeni.com/dbman/
In sub html_record_form, I have:
Code:
<TR><TD align=right valign=top><$font>Category:</font></td>
<TD>|; print &build_select_field_from_db("Category",$rec{'Category'});
if ($per_admin) {
print qq|<BR><input type=text name="Category" size="20" maxlength="255">
<$font>Add a new category</font></td></tr>|;
}
print qq|
Code:
foreach $col (@db_cols) {
$in{$col} =~ s/^~~//;
$in{$col} =~ s/~~$//;
if ($in{$col} =~ /^\s*$/) { # entry is null or only whitespace
if ($db_not_null{$col}) { # entry is not allowed to be null.
push(@input_err, "$col (Can't be Blank)"); # so let's add it as an error
}
}
JPD
http://www.jpdeni.com/dbman/