Gossamer Forum
Home : Products : DBMan : Installation :

&get_defaults

Quote Reply
&get_defaults
I am having a problem customizing a db.pl file. I have customized everything, but when I go to add a page it doesn't pull the defaults from the db.cfg file. For example, the date and ID number. My code for the add form looks like the following:

Code:
sub html_add_form {
# --------------------------------------------------------
# The add form page where the user fills out all the details
# on the new record he would like to add. You should use
# &html_record_form to print out the form as it makes
# updating much easier. Feel free to edit &get_defaults
# to change the default values.

if ($per_mod) {
&html_print_headers;
&custom_header;
print qq|
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
$html_main_top_line
<p><center><$font_title><b>Add a New Record</b></font></center><br>
<center>
<$font>
|; &html_record_form (&get_defaults); print qq|
</font></p>
<p><center> <INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record"> <INPUT TYPE="RESET" VALUE="Reset Form"></center></p>
|; &html_footer; print qq|
</center>
</form>
|;
&custom_footer;
}

else {
&html_print_headers;
&custom_header;
print qq|
<form action="$db_script_url" method="POST">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
$html_main_top_line
<p><center><$font_title><b>Add a New Record</b></font></center><br>
<center>
<$font>
|; &custom_html_add_form (&get_defaults); print qq|
</font></p>
<p><center> <INPUT TYPE="SUBMIT" NAME="add_record" VALUE="Add Record"> <INPUT TYPE="RESET" VALUE="Reset Form"></center></p>
|; &html_footer; print qq|
</center>
</form>
|;
&custom_footer;
}

}

sub html_add_success {
# --------------------------------------------------------
# The page that is returned upon a successful addition to
# the database. You should use &get_record and &html_record
# to verify that the record was inserted properly and to make
# updating easier.

&html_print_headers;
&custom_header;
print qq|
$html_main_top_line
<p><center><$font_title><b>Record Added</b></font></center><br>
<center>
<$font>
<P><Font face="Verdana, Arial, Helvetica" Size=2>The following record was successfully added to the database:</FONT>
|; &html_record(&get_record($in{$db_key})); print qq|
</font></p>
|; &html_footer; print qq|
</center>
|;
&custom_footer;
}
Quote Reply
Re: &get_defaults In reply to
Sorry, JPDeni you can close this I figured out the problem.

I forgot to copy the lines:
Code:
my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

my $font = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
at the beginning of html_record_form.