Gossamer Forum
Home : Products : DBMan : Customization :

Auto Fill When Adding Another

Quote Reply
Auto Fill When Adding Another
I need to have a few of the fields automatically filled in after the first record is added by a user (to reduce redundancy for the user).

I have the following code in my "sub html_record_form"

my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);
if ($in{'add_form'}) {
$in{$db_cols[$auth_user_field]} = $db_userid;
my ($status2,@hits2) = &query("mod");
if ($status2 eq 'ok') {
%rec2 = &array_to_hash(0,@hits2);
# At this point, assign the fields that you want to autofill
$rec{'Name'} = $rec2{'Name'};
$rec{'Address'} = $rec2{'Address'};
$rec{'City'} = $rec2{'City'};
$rec{'State'} = $rec2{'State'};
$rec{'Zip_Code'} = $rec2{'Zip_Code'};
$rec{'Country'} = $rec2{'Country'};
$rec{'Phone_Number'} = $rec2{'Phone_Number'};
$rec{'URL'} = $rec2{'URL'};
$rec{'Email'} = $rec2{'Email'};
}
}
After entering the information, the next time it brings up blank fields.

My add form is not auto generated.

Thank you,