I want to have a hidden key field, that automatically gives a new number to each new db_entry. Is that possible?
Mar 9, 1999, 5:23 AM
Veteran / Moderator (8669 posts)
Mar 9, 1999, 5:23 AM
Post #2 of 7
Views: 2956
If you're using auto-generate, set one up one field (I'll call it ID for illustration purposes). Set the field type to "numer" and set the field length to -1. Make it a required field.
Then set
$db_key = 'ID';
$db_key_track = 1;
(All of this is in the default.cfg file.)
If you're not using autogenerate, do the same things as above and then, in html.pl, use
<input type=hidden name="ID" value="$rec{'ID'}>
for the field.
------------------
JPD
Then set
$db_key = 'ID';
$db_key_track = 1;
(All of this is in the default.cfg file.)
If you're not using autogenerate, do the same things as above and then, in html.pl, use
<input type=hidden name="ID" value="$rec{'ID'}>
for the field.
------------------
JPD
Mar 11, 1999, 7:40 PM
User (365 posts)
Mar 11, 1999, 7:40 PM
Post #3 of 7
Views: 2959
Hey Jp, I'm on to new fields. You mentioned that you need to add it to the html.pl. Well, I did but then I had problems with modifying. So I got paste happy.... I think I pasted too many times. Where do you recommend putting such fields? ie;<input type=hidden name="ID" value="$rec{'ID'} I don't want the user erasing other files. I just want the add part to be as painless as possible. Actually I put it every where a hidden input was ... this was basically stupid of me but I just wanted to cover all angles
Mar 11, 1999, 10:36 PM
Veteran / Moderator (8669 posts)
Mar 11, 1999, 10:36 PM
Post #4 of 7
Views: 2954
Mar 11, 1999, 11:36 PM
User (365 posts)
Mar 11, 1999, 11:36 PM
Post #5 of 7
Views: 2956
Okay that's what I thought in the beginning but I keep getting problems where I try to stick it in.....
my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);
print qq|
<table>
</table>
|;
}
So where does it go? I've tried almost all the spots, and within the table it screws up the formating, outside of the table it tells me that it can't be blank -- I have it as a necessary field. Could that be a problem?
<input type=hidden name="ID" value="$rec{'ID'}>
my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);
print qq|
<table>
</table>
|;
}
So where does it go? I've tried almost all the spots, and within the table it screws up the formating, outside of the table it tells me that it can't be blank -- I have it as a necessary field. Could that be a problem?
<input type=hidden name="ID" value="$rec{'ID'}>
Mar 12, 1999, 1:03 AM
Veteran / Moderator (8669 posts)
Mar 12, 1999, 1:03 AM
Post #6 of 7
Views: 2951
Are you sure you're keeping the field name the same every time? Remember that field names are case-sensitive. If it's "ID" in the field definition, it can't be "id" or "Id" somewhere else.
If your field name is okay, it should be filling in the number automatically as part of the get_defaults subroutine.
------------------
JPD
If your field name is okay, it should be filling in the number automatically as part of the get_defaults subroutine.
------------------
JPD
Mar 12, 1999, 3:01 AM
User (365 posts)
Mar 12, 1999, 3:01 AM
Post #7 of 7
Views: 2958
Hey JP I think I got it working. No it wasn't hairbrain'd variable declaration but I think it had to do with setting it to be a required field in the default.cfg. It didn't like it very much. Also I put it right before the closing bracket "}" at the end. hmmm, won't know for a while if this was the fix or not. thanks for your wonderful help again.