Gossamer Forum
Home : Products : DBMan : Discussions :

Re: admin only fields

Quote Reply
Re: admin only fields In reply to
Thanks!! That helped a lot and helped me to get 90% of the way to where I wanted to go. Here's my sub html_record_form below.

So when a user searches for a record to modify they can search using all fields. When they go to modify_record they can see all fields, but only change the fields that I want them to. I have uploaded the rest of the data for each record and don't want them to change it.

The only problem is that when they go to modify_record, they get
Error: Unable to Modify Record
There were problems modifying the record:

* Last Name (Can not be left blank)
* First Name (Can not be left blank)
* Middle Name (Can not be left blank)
* ID Number (Can not be left blank)
* School (Can not be left blank)
* Grade (Can not be left blank)

Any thoughts? Do iI need to write another if statement for modify_record? I tried this and kept messing up with syntax errors.




my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

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

print qq|
<table width="592" cellpadding="0" cellspacing="0" border="1" bgcolor="#ffffcc">
|;


if($in{'modify_search'}) {
print qq|
<tr>
<td align="right" valign="top" width="118"><$font_color>Last Name:</td>
<td valign="top" width="144"> <input type="text" name="Last Name" size="20" value="$rec{'Last Name'}" maxlength="255"></td>
<td width="132"><$font_color>School:</td>
<td width="198"> |; print &build_select_field("School",$rec{'School'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>First Name:</td>
<td valign="top" width="144"> <input type="text" name="First Name" size="20" value="$rec{'First Name'}" maxlength="255"></td>
<td width="132"><$font_color>Grade:</td>
<td width="198"> |; print &build_select_field("Grade",$rec{'Grade'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Middle Name:</td>
<td valign="top" width="144"> <input type="text" name="Middle Name" size="20" value="$rec{'Middle Name'}" maxlength="255"></td>
<td width="132"><$font_color>Teacher:</td>
<td width="198"> |; print &build_select_field("Teacher",$rec{'Teacher'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>ID Number:</td>
<td valign="top" width="144"> <input type="text" name="ID Number" size="20" value="$rec{'ID Number'}" maxlength="255"></td>
<td width="132"></td>
<td width="198"></td>
</tr>
|;
}


else {
print qq|
<tr>
<td align="right" valign="top" width="118"><$font_color>Last Name:</td>
<td valign="top" width="144"> <$font>$rec{'Last Name'}</Font></td>
<td width="132"><$font_color>School:</td>
<td width="198"> <$font>$rec{'School'}</Font></td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>First Name:</td>
<td valign="top" width="144"> <$font>$rec{'First Name'}</Font></td>
<td width="132"><$font_color>Grade:</td>
<td width="198"> <$font>$rec{'Grade'}</Font></td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Middle Name:</td>
<td valign="top" width="144"> <$font>$rec{'Middle Name'}</Font></td>
<td width="132"><$font_color>Teacher:</td>
<td width="198"> |; print &build_select_field("Teacher",$rec{'Teacher'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>ID Number:</td>
<td valign="top" width="144"> <$font>$rec{'ID Number'}</Font></td>
<td width="132"></td>
<td width="198"></td>
</tr>
|;
}



print qq|
<tr>
<td align="right" valign="top" width="118"></td>
<td valign="top" width="144">
<center>
<b>Sample 1</b></center>
</td>
<td width="132">
<center>
<b>Sample 2</b></center>
</td>
<td width="198">
<center>
<b>Sample 3</b></center>
</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Date-1:</td>
<td valign="top" width="144"> <input type="text" name="Date-1" size="20" value="$rec{'Date-1'}" maxlength="255"></td>
<td width="132"> <input type="text" name="Date-2" size="20" value="$rec{'Date-2'}" maxlength="255"></td>
<td width="198"> <input type="text" name="Date-3" size="20" value="$rec{'Date-3'}" maxlength="255"></td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Standard:</td>
<td valign="top" width="144"> |; print &build_select_field("Standard-1",$rec{'Standard-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("Standard-2",$rec{'Standard-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("Standard-3",$rec{'Standard-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118">
<p><$font_color>C:</td>
<td valign="top" width="144"> |; print &build_select_field("C-1",$rec{'C-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("C-2",$rec{'C-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("C-3",$rec{'C-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>EU:</td>
<td valign="top" width="144"> |; print &build_select_field("EU-1",$rec{'EU-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("EU-2",$rec{'EU-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("EU-3",$rec{'EU-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>TA:</td>
<td valign="top" width="144"> |; print &build_select_field("TA-1",$rec{'TA-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("TA-2",$rec{'TA-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("TA-3",$rec{'TA-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>CA:</td>
<td valign="top" width="144"> |; print &build_select_field("CA-1",$rec{'CA-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("CA-2",$rec{'CA-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("CA-3",$rec{'CA-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Mode:</td>
<td valign="top" width="144"> |; print &build_select_field("Mode-1",$rec{'Mode-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("Mode-2",$rec{'Mode-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("Mode-3",$rec{'Mode-3'}); print qq|</td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Code:</td>
<td valign="top" width="144"> <input type="text" name="Code-1" size="20" value="$rec{'Code-1'}" maxlength="255"></td>
<td width="132" valign="top"> <input type="text" name="Code-2" size="20" value="$rec{'Code-2'}" maxlength="255"></td>
<td width="198"> <input type="text" name="Codes-3" size="20" value="$rec{'Codes-3'}" maxlength="255"></td>
</tr>
<tr>
<td align="right" valign="top" width="118"><$font_color>Language:</td>
<td valign="top" width="144"> |; print &build_select_field("Language-1",$rec{'Language-1'}); print qq|</td>
<td width="132"> |; print &build_select_field("Language-2",$rec{'Language-2'}); print qq|</td>
<td width="198"> |; print &build_select_field("Language-3",$rec{'Language-3'}); print qq|</td>
</tr>
</table>
|;
}


Subject Author Views Date
Thread admin only fields Carlitos 2753 Dec 15, 2000, 5:04 PM
Post Re: admin only fields
Stealth 2693 Dec 15, 2000, 5:31 PM
Thread Re: admin only fields
LoisC 2681 Dec 16, 2000, 3:54 PM
Post Re: admin only fields
Carlitos 2666 Dec 16, 2000, 10:07 PM