Gossamer Forum
Home : Products : DBMan : Installation :

Changing Field Color, html.pl

Quote Reply
Changing Field Color, html.pl
quote:
--------------------------------------------------------------------------------

Even though my Search fields always Come up bold, can I make my "primary" field (Name) ALWAYS appear in bold or a different color when searched?

--------------------------------------------------------------------------------

Do you want it to be in a different color when someone searches on the Name field, or do you just want the Name field to be bold or in a different color all the time? If the latter, all you need to do is change things in html_record. (You'll also have to not use autogenerate.)

If you have created your own html_record, you could post a portion of it here and tell me what you want to do and I will show you how to do it.

---------------------------------------

I want it to appear in BOLD or a specific color ALL THE TIME.

Here's what I have (thanks to someone very special):

sub html_record {

my (%rec) = @_;
($db_auto_generate and print &build_html_record(%rec) and return);
print qq|
<table border=1>
<tr><td align=right valign=top width=20%><$font_color>Name:</font></td>

I would like to have the reutrend value always show up BOLD and in RED (or some color).

Thanks!

Lenny

------------------
Catalyst for the new millenium
Quote Reply
Re: Changing Field Color, html.pl In reply to
Okay.

After the code you have there, use

<td width=80%><$font><font color="red"><B>$rec{'Name'}</B></font></font></td></tr>

This makes it print out in the font that you have previously defined, but in red and in bold. Is this what you had in mind?


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





Quote Reply
Re: Changing Field Color, html.pl In reply to
Yes exactly! Thanks.
Quote Reply
Re: Changing Field Color, html.pl In reply to
Thanks to lots of great help I've been able to change the formatting to some of my html sub-routines, Im still having trouble figuring out the following not because I don't know my HTML code (it could stand some improvement) but becuase I don't know WHICH part of html.pl to change.

1. I would like to Have the Header (the box at the top that says SEARCH RESULTS) just not be so close to the returned table of results. Perhaps add an inch between the "navy" box and the first Field. They're too close together.

2. All my columns are the same length, but I have managed to put to Data columns next to each other by removing <TR> etc., but how can I shorten the length of the first one so they're almost right next to each other. Here's what I have:
<tr colspan=2><td align=right valign=top><$font_color>Price:</font></td>
<td><$font>$rec{'Price'}</font></td>
<td align=right valign=top><$font_color>Avg.Price:</font></td>
<td><$font>$rec{'Avg.Price'}</font></td></tr>

3. Finally, I always try to read through previous questions to find my answers, but I couldn't find exactly what I wanted here although there seemed to be many similar posts.

I'd like to hide one field from general searches (from outside DBMan) but not from admin. At which part of the html.pl do I ad the prin qq| code ($per_admin) html_record...?

Thanks!

------------------
Catalyst for the new millenium
Quote Reply
Re: Changing Field Color, html.pl In reply to
A lot of the html stuff is trial and error. You add in the html, upload it the script, take a look, change something, upload, reload the page, etc. Make little changes and test them out, instead of doing a whole lot at a time. It's easier to find errors if you don't have to search through a whole lot of changes.

One thing to keep in mind. Everything that goes onto the html page must be printed there by the script. So everything must be within a print statement. Keep all of your html coding between a print qq| and |; and you'll be fine.

Since you're using the "user-friendly html.pl" file, the place to change the formatting at the top of the page is in sub html_page_top. You'll see a place that says "$page_title" which is "Search Results" or "Add a Record" or "Search the Database" -- whatever you have defined for the page title of a given page. You can add html coding after the title and before the |; in that subroutine to make it look like you want it to.

I don't really know how to make the fields right next to each other. I would have to experiment with your whole database in order to be able to tell you. This is probably the longest part of setting up DBMan -- making it look like you want it to.

With your data that you want only admins to see, is this just in html_record -- the results of the search? If so, use

Code:
|; # to close off a previous print statement
if ($per_admin) {
print qq|[the data for the field]|;
}
print qq|

If you're talking about a form, it's a little more complex, but not much.

Code:
|; # to close off a previous print statement
if ($per_admin) {
print qq|[the data for the field]|;
}
else {
print qq|[a hidden field]|;
}
print qq|

Does this help?


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





Quote Reply
Re: Changing Field Color, html.pl In reply to
Like this:

|;
if ($per_admin) {
print qq|{'Zip')|;
}
else{
print qq|{a hidden field}|;
}
print qq|

<tr><td align=right valign=top><$font_color>Zip:</font></td>
<td><$font>$rec{'Zip'}</font></td></tr>

I get ('Zip') printed out on the form ?? I don't want the average "searcher" to see the Zip field just the admin people.

Hmm, ??

Thanks!
Quote Reply
Re: Changing Field Color, html.pl In reply to
Like this:

|;
if ($per_admin) {
print qq|{'Zip')|;
}
else{
print qq|{a hidden field}|;
}
print qq|

<tr><td align=right valign=top><$font_color>Zip:</font></td>
<td><$font>$rec{'Zip'}</font></td></tr>

I get ('Zip') printed out on the form ?? I don't want the average "searcher" to see the Zip field just the admin people.

Hmm, ??

Thanks!
Quote Reply
Re: Changing Field Color, html.pl In reply to
Like this:

Code:
|;
if ($per_admin) {
print qq|<tr><td align=right valign=top><$font_color>Zip:</font></td>
<td><$font>$rec{'Zip'}</font></td></tr>
|;
}
print qq|

I just realized you were talking about sub html_record and not sub html_record_form. The above will only print the zip if the person has admin permissions.


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





Quote Reply
Re: Changing Field Color, html.pl In reply to
I am completely confused. Do you want to prevent the zip from appearing to regular users in the display? Or do you want only the admin to be able to enter the zip? The process is really different for changing the form and changing the display.

So, is it the display you want to change or the form?


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





Quote Reply
Re: Changing Field Color, html.pl In reply to
Dear JP,

It did seem to remove it from the basic search, and I was able to see it (Zip) when I tried to modify a record, but then once the record was modified and it showed the new changes the Zip was gone and the actual Zip code moved into the previous field "Comments".

If you have time for me it's at:
www.bestweb.net/~cyborgny/tob/cgi-bin/dbman/html.pl

Thanks!

Lenny
Quote Reply
Re: Changing Field Color, html.pl In reply to
 
Sorry, JUST the display. I think I understand from your frustration what I didn't understand before.

The 'display' is the same regardless of whether it's the result of a search or after a successful modification. Right?

The form is JUST when you are in the process of modifying?

Also a previous question that's come up again: I can search, view, all records but cannot MODIFY. Error: No Matching Records (even though I know they are there!)

Thanks!
Quote Reply
Re: Changing Field Color, html.pl In reply to
 
Sorry, JUST the display. I think I understand from your frustration what I didn't understand before.

The 'display' is the same regardless of whether it's the result of a search or after a successful modification. Right?

The form is JUST when you are in the process of modifying?

Also a previous question that's come up again: I can search, view, all records but cannot MODIFY. Error: No Matching Records (even though I know they are there!)

Thanks!
Quote Reply
Re: Changing Field Color, html.pl In reply to
Right. The display is the same after an add, after a modify or after a search.

I'd have to look at your database again to know why you're not getting any matching records from a modify search. Can you post the URL again?


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