473,795 Members | 2,512 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

confirm update popup?

Hey, all;

Apparently, I'm missing the concept. I'm writing a web app in perl
to manage nagios configuration files. One of the things I'd like to
do is to confirm an update via a popup window prior to writing out
changes.

My first whack at that goal isn't working out too well. I have the
following javascript in one of the pages:

function confirm_update( )
{ var width = 400;
var height = 300;
var Rc = false;
var left = parseInt((scree n.availWidth/2) - (width/2));
var top = parseInt((scree n.availHeight/2) - (height/2));
var winFeatures = "width=" + width + ",height="+heig ht +
",status,resiza ble,left="+left +",top="+top +
",screenX="+lef t+",screenY="+t op;
var cwin = window.open("", "confirm_update ", winFeatures);
var ncontent="<html ><head><title>C onfirm update</title>"
ncontent += "</head>"
ncontent += "<body><h1>Conf irm Update</h1>";
ncontent += "<table align='center'> <<tr>>";
ncontent += "<<td>><but ton ";
ncontent += " onclick='window .close(); return true'>";
ncontent += " <big>Confirm</big></button>";
ncontent += "<<td>><but ton ";
ncontent += " onclick='window .close(); return false'>";
ncontent += " <big>Don't do it!</big></button>";
ncontent += "</<tr>></table></body></html>";
cwin.document.w rite(ncontent);
cwin.document.c lose();
}

And it's called via the onclick method in the submit button:

<button type="submit" onclick="return (confirm_update ())">
<big>Update</big></button>

I've played with this a couple of different ways. The window pops up
like it's supposed to. I can get the function to always validate or
always fail; however, it's never based on the button press.

I know this is because the function is returning before the user even
sees the confir/refute buttons much less presses one of them. I'm
obviously much more used to procedural languages and just can't quite
wrap my brain around a stateless protocol.

I would think this would be a fairly common function. Can someone
point me to some code snippets that would get me started on the right
path?

Thanks for any hints/tips/suggestions...

Doug O'Leary

--

--------
Senior UNIX Admin
O'Leary Computer Enterprises
dk******@oleary computers.com (w) 630-904-6098 (c) 630-248-2749
resume: http://home.comcast.net/~dkoleary/resume.html
Jul 23 '05 #1
3 2847
Lee
Doug O'Leary said:

Hey, all;

Apparently, I'm missing the concept. I'm writing a web app in perl
to manage nagios configuration files. One of the things I'd like to
do is to confirm an update via a popup window prior to writing out
changes.

My first whack at that goal isn't working out too well. I have the
following javascript in one of the pages:

function confirm_update( )
{ var width = 400;
var height = 300;
var Rc = false;
var left = parseInt((scree n.availWidth/2) - (width/2));
var top = parseInt((scree n.availHeight/2) - (height/2));
var winFeatures = "width=" + width + ",height="+heig ht +
",status,resiza ble,left="+left +",top="+top +
",screenX="+lef t+",screenY="+t op;
var cwin = window.open("", "confirm_update ", winFeatures);
var ncontent="<html ><head><title>C onfirm update</title>"
ncontent += "</head>"
ncontent += "<body><h1>Conf irm Update</h1>";
ncontent += "<table align='center'> <<tr>>";
ncontent += "<<td>><but ton ";
ncontent += " onclick='window .close(); return true'>";
ncontent += " <big>Confirm</big></button>";
ncontent += "<<td>><but ton ";
ncontent += " onclick='window .close(); return false'>";
ncontent += " <big>Don't do it!</big></button>";
ncontent += "</<tr>></table></body></html>";
cwin.document.w rite(ncontent);
cwin.document.c lose();
}

And it's called via the onclick method in the submit button:

<button type="submit" onclick="return (confirm_update ())">
<big>Update</big></button>

I've played with this a couple of different ways. The window pops up
like it's supposed to. I can get the function to always validate or
always fail; however, it's never based on the button press.

I know this is because the function is returning before the user even
sees the confir/refute buttons much less presses one of them. I'm
obviously much more used to procedural languages and just can't quite
wrap my brain around a stateless protocol.

I would think this would be a fairly common function. Can someone
point me to some code snippets that would get me started on the right
path?


If you want submission to depend on the return value of
an event handler, use the onSubmit event handler of the
form, not the onclick handler of the submit button.

Your function confirm_update( ) doesn't return a value, so
"return confirm_update( )" isn't going to control anything.

The window has a confirm() method that does what you want:
<form name="whatever" ... onsubmit="retur n confirm('Update ?')">

Jul 23 '05 #2
Doug O'Leary wrote:
Hey, all;

Apparently, I'm missing the concept. I'm writing a web app in perl
to manage nagios configuration files. One of the things I'd like to
do is to confirm an update via a popup window prior to writing out
changes.
A much simpler 'confirm' dialog is:

<form ... onsubmit="retur n confirm('Do update?');">

Zero issues with pop-up blockers (some block requested pop-ups too).

[...]
I know this is because the function is returning before the user even
sees the confir/refute buttons much less presses one of them. I'm
obviously much more used to procedural languages and just can't quite
wrap my brain around a stateless protocol.


Using a 'confirm' dialog gives you a modal dialog.
[...]
--
Rob
Jul 23 '05 #3
On 2005-06-26, Lee <RE************ **@cox.net> wrote:

The window has a confirm() method that does what you want:
<form name="whatever" ... onsubmit="retur n confirm('Update ?')">


Lee and Rob, thanks. That's exactly what I was looking for.
Simple and elegant... Too cool. Thanks again.

Doug

--

--------
Senior UNIX Admin
O'Leary Computer Enterprises
dk******@oleary computers.com (w) 630-904-6098 (c) 630-248-2749
resume: http://home.comcast.net/~dkoleary/resume.html
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
11150
by: Tasha's Dad | last post by:
A description of the problem: 1) Go to a page with various settings and a timeout (forces re-login if over 10 minutes) 2) Before the timeout, make some changes to settings. 3) Press a "reset to defaults" button that uses a confirmation box to let the user know what is about to be reset (lists items). 4) Walk away while the confirm box is displayed and come back after the page timeout. 5) My screen now has the page, a confirm popup on top...
2
2840
by: Hans | last post by:
Hi! I have an asp application where I use a lot of javascript for validations etc and as it is today I use alert, confirm and prompt dialogs. Now we are adding support for unicode and I have problems with the font used to present messages in alert, prompts and confirm dialogs. If I for examle paste a chinese value in a prompt dialog it is shown om my machine as a vertical bar. When I write the value back to a textbox <input type="text"...
1
5253
by: Sandy | last post by:
I have a repeater which shows Group names. (Skip this part if you want rather irrelevant) The groups are ordered and formatted: Parent ---Child ------Grand Child (okay start reading again please)
0
1166
by: aaa | last post by:
I am at my wits end I an trying to pass a couple of values to a page with a UC (parent) from a popup (child). But only after a JS confirm on the child popup. Seems straight forward. I have only been able to get half working on either side but not the whole package. I have tried full client side JS, I have tried RegisterClientScriptBlock ( think this is the more viable option ). Any help would be appreicated.
9
14005
by: Indu | last post by:
How can I customise something that a standard confirm() function gives us. I need to do something like if a user clicks on a link, a popup should say, "do you want to leave this page" and the buttons that we need is "yes - no" instead of "ok - cancel". I tried doing it with window.open() but without any success. I couldn't figure out how to make a pop-up window return true or false to the main window. Anyone got any ideas?!! thank...
17
3857
by: Chris Ianson | last post by:
Hi, I have this JavaScript, which I only want to occur if a user clicks on a hyperlink hotspot in a large image: <script type="text/javascript"> <!-- var answer = confirm ("This link is not available, click OK to load a similar link, or Cancel to not.") if (!answer) window.location="http://www.yahoo.com/" // -->
4
2268
by: ChrisA | last post by:
I need to get the user to confirm a button push/postback with a popup from the browser, in ASP.NET 1.1. What's the right way to wire that up?? Thanks
3
8748
by: OccasionalFlyer | last post by:
I have become owner of some Javascript code that displays a message through the confirm() function. I have a uwser reuqest to make the font size of this message larger. Can this be done? I don't see readily a way to modify the font or other properties of the popup created by confirm(). Thanks. Ken
4
3760
by: Arnab das | last post by:
Below is the javascript code i am using function confirmDelete() { var returnValue = window.confirm("Deleting the current page. Continue?"); return returnValue; // var returnValue = $find('mdlPopUpExt').show();
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.