Gossamer Forum
Home : Products : DBMan : Customization :

Initial Value in a field

Quote Reply
Initial Value in a field
I have a field that uses the Username for the DB. How can I have the field on the Add section have an initial value of the person's user name? I've looked around and can't seem to find something that has been addressed like this before. Thanks for any help!
Quote Reply
Re: [Reyhan] Initial Value in a field In reply to
Funny you should ask. I just was thinking about that today and wrote a little mod for it.

First, you need to set the $auth_user_field in your .cfg file to the number of the field where your userid is.

Then, in db.cgi, sub get_defaults, after

my (%default);

add

Code:
if ($auth_user_field >= 0) {
$user_field_name = $db_cols[$auth_user_field];
$default{$user_field_name} = $db_userid;
}



As the script is written, it will add the userid at the time the record is actually added to the database, but I think it's nice to see it in the field.


JPD
----------------------------------------------------
JPDeni's DBMan-ual
How to ask questions the smart way.

Last edited by:

JPDeni: Feb 20, 2006, 7:02 PM