Gossamer Forum
Home : Products : DBMan : Installation :

admin-Only

Quote Reply
admin-Only
For some reason when I include the if ($per_admin){....statement I will get an error" DBman encountered an Internal error"

This is what I typed in

sub html_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info.

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';

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">|;
if ($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>ID:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR>|;
}
else {
print qq|<input type="hidden" name="ID">|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Name:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Name" VALUE="$rec{'Name'}" SIZE="40" MAXLENGTH="255"></TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Date" VALUE="$rec{'Date'}" SIZE="12" MAXLENGTH="12"></TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Category:</FONT></TD>
<TD VALIGN="TOP"> |; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Message:</FONT></TD>
<TD VALIGN="TOP"> <TEXTAREA NAME="Message" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA></TD></TR>
</TABLE>
|;
}
Prior to this I was able to login. I am finding this very frustrating. I still have an outstanding problem from before but I like to get this one resolve first. Thank you.
Perl is not my strength so please be clear and patient with me. I greatly appreciate it. :-)

Always on a mission!!
Quote Reply
Re: admin-Only In reply to
You seem to be closing your print qq| statement too early. (and in a number of places I might add)

else {
print qq|<input type="hidden" name="ID">|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Name:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Name" VALUE="$rec{'Name'}" SIZE="40" MAXLENGTH="255"></TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Date" VALUE="$rec{'Date'}" SIZE="12" MAXLENGTH="12"></TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Category:</FONT></TD>
<TD VALIGN="TOP"> |; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>|;
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Message:</FONT></TD>
<TD VALIGN="TOP"> <TEXTAREA NAME="Message" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA></TD></TR>
</TABLE>
|;
}


Try taking out the code I have highlighted in red.

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: admin-Only In reply to
Thank you! Thank you! You are a Lifesaver, AstroBoy.

Always on a mission!!
Quote Reply
Oh No Problem: ID (Can not be left blank) In reply to
I can login now.
I haven't made any changes to the password for author.
When I login as author to add a record I will get that error shown under the subject heading.
The good news--I can't see the ID field when I am login as author.
Bad news-- won't allow me to add record because it wants me to fill in ID field which doesn't appear in the first place.
I checked my default.cfg and under 'not_null' it is -1

ID=>[0,'numer', 5,8,-1,", "],
like this!!
What do you suggest?

Always on a mission!!
Quote Reply
Re: Oh No Problem: ID (Can not be left blank) In reply to
I see the prob, you just need a VALUE="" for your hidden field:
else {
print qq|<input type="hidden" name="ID" value="$rec{'ID'}">|;
}


- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: Oh No Problem: ID (Can not be left blank) In reply to
Thank you once again. It works.
You are so professional and humble. I can tell from your replies.
Thanks.
*grin*

Always on a mission!!
Quote Reply
Create your own forms and displays-JPDeni's Manual In reply to
The tutorial has been quite help and so are you BTW.
So far everything works except that the contents in the last field does not appear when I "list all". The last field uses the <textarea> tag.

Here is the script:

sub html_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info.

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';

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">|;
if($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>ID:</FONT></TD><TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR>|;
}
else {
print qq|<input type="hidden" name="ID" value="$rec{'ID'}">|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Name:</FONT></TD><TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Name" VALUE="$rec{'Name'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD><TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Date" VALUE="$rec{'Date'}" SIZE="12" MAXLENGTH="12"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Category:</FONT></TD><TD VALIGN="TOP"> |; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Message:</FONT></TD><TD VALIGN="TOP"> <TEXTAREA NAME="Message" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA></TD></TR>
</TABLE>
|;
}

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">|;
if($per_admin) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>ID:</FONT></TD><TD VALIGN="TOP"> $rec{'ID'}</TD></TR>|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Name:</FONT></TD><TD VALIGN="TOP"> $rec{'Name'}</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD><TD VALIGN="TOP"> $rec{'Date'}</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Category:</FONT></TD><TD VALIGN="TOP"> $rec{'Category'}</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Message:</FONT></TD><TD VALIGN="TOP"> $rec{'Description'}</TD></TR>
</TABLE>
|;
}

##########################################################
## Home Page ##
##########################################################

Why doesn't the messages I write appears in the message field?


Always on a mission!!
Quote Reply
Re: Create your own forms and displays-JPDeni's Manual In reply to
The field NAME and RECORD HASH value DO NOT match in the following codes:

Code:

<TEXTAREA NAME="Message" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA>


Look at the bolded codes...See the problem???

The NAME of the field (no matter what type) must match the corresponding value attribute (denoted by the record hash).

In other words, Message must be changed to Description OR if the name of your field is Message, then you must edit the $rec{'Description'} codes.

Regards,

Eliot Lee

Quote Reply
Thank you In reply to
Thank you.
I thought if I was consistant in using ('Description') it would work. Well now I know.
Thxs!!

Always on a mission!!