Gossamer Forum
Home : Products : DBMan : Customization :

DELETE - final warning - code request

Quote Reply
DELETE - final warning - code request
In the DELETE record section once the box is ticked and the button pressed the record is gone forever.

Does anyone have the code that would give you a final warning just like all other programs.

"Are you sure you want to delete this record"

Maybe even just an alet box as a final safety net before the record vanishes forever.
Quote Reply
Re: [kingdom] DELETE - final warning - code request In reply to
go to the FAQ database at http://redundantcartridge.com/dbman/ and do keyword search for delete. this is an unbelievable resource and is always the first place i look for answers.
Quote Reply
Re: [delicia] DELETE - final warning - code request In reply to
Thanks, found the code there that will serve my needs
Tried this but getting "500 internal error" switched debug on but no info, anyone any ideas?

#In sub html_delete_form in html.pl, changed
<INPUT TYPE="SUBMIT" name="delete_records" VALUE="Delete Checked Record(s)">
to:
<INPUT TYPE="SUBMIT" name="confirm_deletion" VALUE="Delete Checked Record(s)">
#In sub main in db.cgi, added this block to the list of "elsif"-blocks that's already there:
elsif ($in{'confirm_deletion') { if ($per_del) { &html_confirm_deletion; } else { &html_unauth; } }

#Added to html.pl, replaced the original "&html_page_top;" and "&html_page_bottom;" with &html_print_headers; and &html_footer;


sub html_confirm_deletion {
#------------------------------------------------------
$page_title ="$html_title: Confirm Deletion";
&html_print_headers;
print qq|
<form action="$db_script_url" METHOD="POST" name="form1">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
Press "confirm deletion" to delete these records once and for all.<br>|;
foreach $key (keys %in) {
if ($in{$key} eq "delete") {
my %rec = &get_record($key);
&html_record (%rec);
print qq|<INPUT TYPE="HIDDEN" NAME="$key" VALUE="delete">|;
}
}
print qq|<p><center><input class="button" type="submit" name="delete_records"
value="confirm deletion"></center></form></p>|;
&html_footer;
}
Quote Reply
Re: [kingdom] DELETE - final warning - code request In reply to
This line has problems:

elsif ($in{'confirm_deletion') { if ($per_del) { &html_confirm_deletion; } else { &html_unauth; } }

looks like a bracket is missing:

elsif ($in{'confirm_deletion'}) { if ($per_del) { &html_confirm_deletion; } else { &html_unauth; } }
Quote Reply
Re: [Watts] DELETE - final warning - code request In reply to
Thanks Watts, well spoted that cured the problem and it works perfectly now.

Apreciate your time.