question: perl cgi/dbi script with javascript dialog box 
Author Message
 question: perl cgi/dbi script with javascript dialog box

I am writing perl cgi/dbi scripts that deletes and adds records from a
database.  I got it working, but need to display a dialog box
confirming a deletion before deleting a record from the database.  The
only way I know how to make a dialog box is from the javascript method
of window.confirm().  I have a code fragment that does not work.
Please see below.

Code fragment:
// In javascript before the html body tag
function delconfirm()
{
   msg = "Are you sure you want to delete this record?";
   var x = confirm(msg)
   if (x)
      window.location.replace("/cgi-bin/conflicts")
   else
      window.location.replace("/cgi-bin/conflicts_nodel")

Quote:
}

# In Perl CGI, later on in the script
   print $query->submit(-name=>'delete_data',-value=>'Delete',-
onClick=>'delconfirm()');

The way I have the submit button is that the action "onClick" executes
the dialog confirm box, which pops up and asks the confirm msg. The
javascript method, location.replace(url), replaces one displayed
document with another.  If the answer to the confirm dialog box is yes,
then it replaces the location to a cgi script that does the deletion.
If the answer is yes, then it replaces the location to go to a page
that does not have the deletion capability.

However, this code will not change the location to the desired pages.
It merely reloads the current page.  What am I doing wrong?

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Getting around javascript dialog box confirm button

2. perl cgi/dbi with javascript question

3. CGI saving file dialog box

4. Newbie question about dialog box

5. javascript in perl CGI scripts.

6. Passing a Javascript cookie to a Perl/CGI script

7. Help with perl/cgi (using book: perl,cgi, and javascript complete)

8. Help with perl/cgi (using book: perl,cgi, and javascript complete)

9. Creating dialog boxes with tkperl

10. Dialog box module for Win32?

11. Help: Dialog box in web browser

 

 
Powered by phpBB® Forum Software