Gossamer Forum
Home : Products : DBMan : Installation :

Need Time Stamp

Quote Reply
Need Time Stamp
Hi all,

I need a put a time stamp when someone
adds a record, similar to the date stamp.
I searched the arhives but didn't really
come up with anything.
Thanks for all the help.
PB:-)
Quote Reply
Re: Need Time Stamp In reply to
All you have to do is replace &get_date for the default configuration in your db_def hash with &get_time.

So, the field configuration would look like the following:

Code:
TimeStamp => [10, 'alpha', 20, 40, 1, &get_time, ''],

Replace 10 with the last field number in your db_def hash.

If this doesn't work, try using time rather than alpha.

In your html.pl file, add the following input fields to the appropriate sub-routines (like sub html_record_form, sub html_record, etc.):

Code:
Time Stamp: <input type="text" name="TimeStamp" value="$rec{'TimeStamp'}" size="40">

If you want this field to be uneditable and "hidden" to regular users, but available for admins to edit the value, all you have to do is add the following codes:

Code:
|;
if ($per_admin) {
print qq|Time Stamp: <input type="text" name="TimeStamp" value="$rec{'TimeStamp'}" size="40">|;
}
else {
print qq|Time Stamp: Time Stamp <input type="hidden" name="TimeStamp" value="$rec{'TimeStamp'}">|;
}

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------




[This message has been edited by Eliot (edited November 01, 1999).]
Quote Reply
Re: Need Time Stamp In reply to
I'm assuming that to hide the TimeStamp field, you need to put the following code in both the sub html_record_form & the sub html_record after the |;, correct?

thanks
Quote Reply
Re: Need Time Stamp In reply to
That is correct. I use hidden fields like the one I gave you so that users will not inadvertantly (or on purpose) change those fields, especially with auto-generated fields like date and time. Cause if you keep that field open to be edited, then users will keep getting error messages when editing or adding records.

Hope this helps.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Need Time Stamp In reply to
Hi Eliot,

Your code below worked fine, I needed
both the date and timestamp, so I just
added it to the cfg file.
Thanks again for your help!
PB:-)

TimeStamp => [10, 'alpha', 20, 40, 1, &get_time, ''],



The ADSTREAM revolution is here!! Don't be left out!!
http://www.adstreampremier.com/bellap.html

Quote Reply
Re: Need Time Stamp In reply to
Great...Glad it worked.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------