Home : Products : DBMan : Customization :

Products: DBMan: Customization: Re: [tilmes] hide html_record_form (%rec);: Edit Log

Here is the list of edits for this post
Re: [tilmes] hide html_record_form (%rec);
Okay, let's try this again Smile Deleted it once already Crazy

You need to have all of your fields listed in the databse configuration file. (Your users cannot "add" fields at a different point unless the fields are already configured.

In sub html_record_form use hidden fields for everything you do not want a visitor to complete when initially entering a record, just like you do with some fields now. (Add the additional hidden fields at the bottom of the table.)

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="3" MAXLENGTH="3"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Title:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="Title" VALUE="$rec{'Title'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>URL: </FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="URL" VALUE="$rec{'URL'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Type: </FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_select_field ("Type", "$rec{'Type'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Date:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<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">&nbsp;|; print &build_select_field ("Category", "$rec{'Category'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Description:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<TEXTAREA NAME="Description" ROWS="4" COLS="40" WRAP="VIRTUAL" MAXLENGTH="255">$rec{'Description'}</TEXTAREA></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Validated:</FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_radio_field ("Validated", "$rec{'Validated'}"); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Popular:</FONT></TD>
<TD VALIGN="TOP">&nbsp;|; print &build_checkbox_field ("Popular", "$rec{'Popular'}"); print qq|</TD></TR>
|;
### These fields will display only if Admin is viewing record or
### When the record owner is viewing in Modify Mode
if (($per_admin) or (($db_uid eq $rec{Userid}) && $in{'modify'})) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Another Field:</FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="AnotherField" VALUE="$rec{'AnotherField'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Field Was Hidden: </FONT></TD>
<TD VALIGN="TOP">&nbsp;<INPUT TYPE="TEXT" NAME="FieldWasHidden" VALUE="$rec{'FieldWasHidden'}" SIZE="40" MAXLENGTH="255"></TD></TR>
|;
}
else {
print qq|
<INPUT TYPE="HIDDEN" NAME="AnotherField" VALUE="$rec{'AnotherField'}">
<INPUT TYPE="HIDDEN" NAME="FieldWasHidden" VALUE="$rec{'FieldWasHidden'}">
|;
}

### Now we resume printing to close the table.
print qq|
</TABLE>
|;
}

- - - - - -
Then, you do not need to make a bunch of modifications to your sub html_modify_form.

Last edited by:

Karen: Jan 27, 2002, 3:30 PM

Edit Log: