Gossamer Forum
Home : Products : DBMan : Installation :

Modifying dbman's appearance

Quote Reply
Modifying dbman's appearance
Thanks so much for all your help to date. The Job Connection is going really well. I have slightly modified some of the pages, but now I'm into the hard stuff. I'm sort of new to CGI (I don't know the esoteric tricks yet.)

I would like to replace the field names in add-record, etc. with English-language equivalents. I don't quite understand how html_record_form works.

Also -- where is get_defaults? It appears to be called from html_add_form and the results seem to be sent to html_record_form. If I could trace the code I probably could figure it out for myself. BUT your help is greatly appreciated.

The db is called "jobs" and it is at www.faithtalk.net/cgi/dbman/...
Quote Reply
Re: Modifying dbman's appearance In reply to
You may need to do some work on your tables in the display portion. I think you may be missing some closing </table> tags or something. When I looked at your site with Netscape, the database home page was blank. (Netscape is less forgiving about closing tags than Internet Explorer is.)

I started to write a tutorial on how to customize the html_record_form subroutine, but I've been at it for quite a while and I'm still not finished. I was trying to explain all of the Perl stuff at the same time as I told you how to do things. It's just a little too complex to do all at once.

So, rather than overwhelm you with details, the best thing I can suggest is to follow the patterns in sub html_record_form. For each field you will need to know

(A) -- the label you want your users to see
(B) -- the field name -- exactly as it is in the .cfg file. Letter case counts!
(C) -- the field length as defined in your .cfg file
(D) -- the max length as defined in your .cfg file

I'll reference these letters in the patterns below.

For hidden fields (ones which have the field length set to -1), use

Code:
<input type="hidden" name="B" value="$rec{'B'}">

For text fields, use

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>A:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="B"
VALUE="$rec{'B'}" SIZE="C" MAXLENGTH="D"></TD></TR>

For select fields -- ones that you have defined in %db_select_fields in the .cfg file-- use

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>A: </FONT></TD>
<TD VALIGN="TOP"> |; print &build_select_field ("B", "$rec{'B'}"); print qq|</TD></TR>

Text area fields are a little different. You would have defined their field length as something like '40x3'. I'll refer to the number of columns as C1 and the number of rows as C2.

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>A</FONT></TD>
<TD VALIGN="TOP"> <TEXTAREA NAME="B" ROWS="C2" COLS="C1"
WRAP="VIRTUAL" MAXLENGTH="D">$rec{'B'}</TEXTAREA></TD></TR>

You aren't using any radio fields or checkbox fields, but I'll put them in anyway in case someone else is following along.

To make a checkbox field:
Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>A: </FONT></TD>
<TD VALIGN="TOP"> |; print &build_checkbox_field ("B", "$rec{'B'}"); print qq|</TD></TR>

To make a radio field:
Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>A: </FONT></TD>
<TD VALIGN="TOP"> |; print &build_radio_field ("B", "$rec{'B'}"); print qq|</TD></TR>

Leave $db_auto_generate set to 1 in your .cfg file (because you haven't defined your display yet) and put a # in front of the second "real" line in html_record_form, so it looks like

Code:
# ($db_auto_generate and print &build_html_record_form(%rec) and return);

Then upload the file and test it out.

I'll tell you more about things like "admin only" fields after you get this done.

Regarding the get_defaults subroutine, it is in the db.cgi script. But you shouldn't have to alter it. You can define default values directly in the .cfg file. If you don't understand how, just ask.



------------------
JPD







[This message has been edited by JPDeni (edited June 29, 1999).]
Quote Reply
Re: Modifying dbman's appearance In reply to
Thank you so much! What you gave me was enough to get me going. I think I have everything pretty well now. If you would like to take a look, hop over to www.faithtalk.net.

I do have one little question that you might know the answer to. In Netscape (but not in IE) there is a line beneath the header (I added a call to PrintMyHeader on every page). Do you know what is causing that?

Thanks again for all your help.
Cathy
Quote Reply
Re: Modifying dbman's appearance In reply to
Looks good!

I don't know what's causing the line. It could have something to do with the Javascript stuff you have. I don't know enough about the differences between browsers or Javascript to be able to answer.

------------------
JPD