This may work for you:
Prevent Duplicate ID # due to page Reload
in HTML.PL
Add this to top of your file for reference of changes made:
### prevent NEW ID on reload - added codes in sub html_add_failure
sub html_add_failure {
# --------------------------------------------------------
AFTER:
my ($message) = $_[0]; add:
### prevent dup ID # . . also commented out code in .cgi sub add_record ###
if ($message eq "duplicate key error") {
&html_home;
return;
}
### prevent dup ID numbers ####
In your .CGI: in sub add_record
Add this to top of your file for reference of changes made:
# prevent NEW ID on reload - removed codes in sub add_record
AFTER: # First we validate the record to make sure the addition is ok.
$status = &validate_record;
##### comment out the following to prevent a new ID # being assigned when the form
is reloaded ####
## We keep checking for the next available key, or until we've tried 50 times after which
we give up.
# while ($status eq "duplicate key error" and $db_key_track) {
# return "duplicate key error" if ($counter++ > 50);
# $in{$db_key}++;
# $status = &validate_record;
# }
This is fully tested and works great!
-----
You could also provide a link within the record to go directly to the modify screen such as:
|;
print qq!<A HREF="$db_script_url?db=$db_setup&uid=$db_uid&modify_form_record=1&modify=$rec{$db_key}">Modify Record</A> ! if ($per_mod);
print qq|
Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/