Gossamer Forum
Home : Products : DBMan : Installation :

Auto Fill In Fields

Quote Reply
Auto Fill In Fields
I would like to have some fields of the form for adding a record filled in automatically. The fields would be: name of person, their location, and their e-mail address. All of this information would be filled in when the account is created by me, and I was wondering where to store it and how to associate it with these fields so it does not have to be typed in for each record that they add. It would be automatically entered when they click on the "Add Record" button.
Quote Reply
Re: Auto Fill In Fields In reply to
One more question, just to be sure. In the file that has the user info, there would be a field that includes the userid for the user, right? What field number would that be?

What are the field names that you want to pass from one database to the other?


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





Quote Reply
Re: Auto Fill In Fields In reply to
I'm not sure if I'm getting this right, but the name I want to fill in automatically would be the logged on user id ("UID"?), for location I would use "TB" as the variable and for e-mail I would use "TEM".
Quote Reply
Re: Auto Fill In Fields In reply to
It would be best to store it in a .db file.

Do you want the values to appear on the add form or do you just want them added after the user submits the add form?

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





Quote Reply
Re: Auto Fill In Fields In reply to
I would like the values to appear in the add form. I already have a pretty much finished db up and running, I'm just trying to put some extras in it to make it easier to use.

Thanks again Carol!

Sean
Quote Reply
Re: Auto Fill In Fields In reply to
Filling in the name of the logged in user isn't a problem. The variable is $db_userid. What I'm wondering about is if your other file has the same userid in it so the script will know what record to use.

For example, lets say that this was your external db file:
Code:
jpdeni|me@myserver.com|Kent, WA
fred|fred@bedrock.com|Bedrock, CA
george|george@jetson.com|Metropolis, Saturn

Is that the way the file is set up? You could have more fields than that, but these are the ones you will need.

If I'm understanding you correctly, when "george" adds a record, you want to pull in the data and make

$rec{'TB'} = 'Metropolis, Saturn'
$rec{'TEM'} = 'george@jetson.com'
$rec{'UID'} = 'george'

Is that correct?


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





Quote Reply
Re: Auto Fill In Fields In reply to
That's exactly what I am looking for!

Sean
Quote Reply
Re: Auto Fill In Fields In reply to
So... did you have any insight on where I should start adding these variables?
Quote Reply
Re: Auto Fill In Fields In reply to
Sorry. I missed your response yesterday. Sometimes it gets pretty confusing. Smile

You can add code to sub get_defaults:

After

Code:
foreach $field (keys %db_defaults) {
$default{$field} = $db_defaults{$field};
}

add

Code:
open (DEF, "<path/to/file") or &cgierr("error in get_defaults. unable to open file.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); )
@lines = <DEF>;
close DEF;

foreach $line (@lines) {
chomp ($line);
@data = &split_decode($line);
if ($data[0] eq $db_userid) {
$default{'TB'} = $data[2];
$default{'TEM'} = $data[1];
$default{'UID'} = $db_userid;
last;
}
}


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





Quote Reply
Re: Auto Fill In Fields In reply to
Carol, I am still having trouble with this... Let me re-explain it and see if maybe we are crossing wires somewhere )

When creating new accounts, or updating current accounts, I would like to be able to add information such as E-Mail Address, Branch, Location. This information would be stored in the .pass file with their userid, password, and permissions.

When a user goes to Add a record, I would like the record Add form to pop up with the date, time, userID, branch, E-mail, and location information already entered, this would be drawn from his initial login and the .pass file.

I am having a rough time with this one, I've been at it for about a week and am getting a little bit more confused each day... Please help!
Quote Reply
Re: Auto Fill In Fields In reply to
Carol,

I Hope that you're feeling better... I think that I speak for all of us here when I say that we certainly miss you when you're not around. If you get a chance, can you take a look at my last post and give me a clue as to what direction I should be heading with this? You've inspired me, I purchased a few Perl books to get a bit more knowledge from, but so far I haven't been able to work out how my little scenario here should be done.

Thanks again,

Sean
Quote Reply
Re: Auto Fill In Fields In reply to
I can anticipate Carol's response since she has stated it to other users..."Additional fields should not be added to the .pass file." What you could consider doing, which I believe is what Carol was providing is to create a separate .db file and then pull the values from that second .db file into the add form for your original database file.

One of Carol's post regarding opening the other file and then taking values out of it based on the $db_userid is what you need to be looking at.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Auto Fill In Fields In reply to
Eliot,

Thanks for your response, do you know which thread Carol was discussing this in? Also you mention, "What you could consider doing, which I believe is what Carol was providing is to create a separate .db file" When you say this, do you mean that Carol has made a Mod to do this? or that she has discussed this... if the later, do you know where I may find that information?

Thanks,

Sean
Quote Reply
Re: Auto Fill In Fields In reply to
Sean,

She has discussed this in tons of Threads in the Discussion Forum. Try searching for the following keywords:

"Members" "member.db" "Member Database"

in the DBMAN Discussion Forum and you SHOULD find pertinent Threads relating to your topic.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us