Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Popup Message Box?

by jclovs (Sexton)
on Nov 15, 2001 at 20:08 UTC ( #125595=note: print w/replies, xml ) Need Help??


in reply to Popup Message Box?

Well, here is an example of what you could use:
$q = new CGI; if(defined($q->param("confirm"))) { if($q->param("confirm") eq "yes"){ #execute code for yes } else { #execute code for no } } else { print $q->header(), "<html>\n", "<head>\n", "<script laguage\"JavaScript\">\n", "<!--\", "popup=window.open(\"\", \"Confirm\",\"width=350, height=400, + toolbar=no menubar=no, scrollbars=no, resizeable=no\")\n", "popup.location.href=\"http://domain.com/confirm.html\n\", "popup.opener.name = \"opener\", "// -->\n", "</script>\n", "</head>\n<body>", "</body></html>"; }
Then your confirm.html page could look like this
<html> <body> <form target="opener" action"location.of.script" method="post" o +nsubmit="window.close()"> <input type="radio" value="yes" name="confirm">Yes <input type="radio" value="no" name="confirm">No <input type="submit" value="submit" name="submit"> </form> </body> </html>
Update: I'm not sure and I didn't feel like testing it right now but the onsubmit tage in the form might be slightly miss written. What might happen, unfortunately is that the window would close before the form got submitted. So instead of testing the code, I will offer an alt. so as to make my life easier. First delete the onsubmit attribute. Then put this code replace the perl ouput code to this:
... else { print $q->header(), "<html>\n", "<head>\n", "<script laguage\"JavaScript\">\n", "<!--\", "popup=window.open(\"\", \"Confirm\",\"width=350, height=400, + toolbar=no menubar=no, scrollbars=no, resizeable=no\")\n", "popup.location.href=\"http://domain.com/confirm.html\n\", "popup.opener.name = \"opener\", "// -->\n", "</script>\n", "</head>\n<body onunload=\"popup.close();\">", "</body></html>"; } ...
P.S. this might just be a better all around solution.
Clovs aka jclovs

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://125595]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2023-06-08 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (29 votes). Check out past polls.

    Notices?