473,386 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Confirm dialog box

Hello,

I need a method to create Dialog box in PHP to confirm an action like
for instance, sending an e-mail, so if "OK" is clicked action is
performed and if "Cancel" is clicked action is canceled.

I found some examples that are implementing "javascript:return
confirm()" function in "onSubmit" event of a form but none of such
methods is functioning (?).

Is there any way to do this in PHP ?

Thanks,

Tomislav
May 20 '07 #1
5 20388
Tomislav wrote:
Hello,

I need a method to create Dialog box in PHP to confirm an action like
for instance, sending an e-mail, so if "OK" is clicked action is
performed and if "Cancel" is clicked action is canceled.

I found some examples that are implementing "javascript:return
confirm()" function in "onSubmit" event of a form but none of such
methods is functioning (?).

Is there any way to do this in PHP ?

Thanks,

Tomislav
Not really. You can't open new windows in PHP.

Your best bet is javascript - it works, just ensure you have javascript
enabled. Or you can take them to a new "confirm" window. If they
confirm then continue. If they do not, return to the previous page.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 21 '07 #2
Your best bet is javascript - it works, just ensure you have javascript
enabled. Or you can take them to a new "confirm" window. If they
confirm then continue. If they do not, return to the previous page.
Thank you for your quick response. Below is code snippet I use as
template to construct my own JavaScript code.

**

<form method="post" action="mail.php" onSubmit="javascript:return
confirm('Do you really want to send this order ?);">

**

When I include Submit button in this form form action should be
performed, e.g. "mail.php" should be executed. Only thing is that it is
executed directly without any confirm windows.

JS is enabled and browser is Firefox 2.0. What is more I frequently use
JS in my designs and this very site I am working on now has plenty of JS
included. That is a bit confusing - that code above does not work.

Did I miss something when I incorporated JS in form ?

Thanks,

Tomislav
May 21 '07 #3
Tomislav wrote:
>
>Your best bet is javascript - it works, just ensure you have
javascript enabled. Or you can take them to a new "confirm" window.
If they confirm then continue. If they do not, return to the previous
page.

Thank you for your quick response. Below is code snippet I use as
template to construct my own JavaScript code.

**

<form method="post" action="mail.php" onSubmit="javascript:return
confirm('Do you really want to send this order ?);">

**

When I include Submit button in this form form action should be
performed, e.g. "mail.php" should be executed. Only thing is that it is
executed directly without any confirm windows.

JS is enabled and browser is Firefox 2.0. What is more I frequently use
JS in my designs and this very site I am working on now has plenty of JS
included. That is a bit confusing - that code above does not work.

Did I miss something when I incorporated JS in form ?

Thanks,

Tomislav
Sorry, I don't know - I'm not that great on javascript. Try
comp.lang.javascript for javascript questions.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 21 '07 #4
I usually catch the submit action from the submit button. Would you care
to see what that gives? The event procedure must cancel the default
action, cross-browser... let me look this one up... nah, return false
will do.

Does that help enough?

Yow, now I re-read your snippet, something strikes me: inside the inline
onsubmit definition, there is no need to put 'javascript:'. Maybe that
is all it takes.

Uit het bericht van Jerry Stuckle:
Tomislav wrote:
>>
>>Your best bet is javascript - it works, just ensure you have
javascript enabled. Or you can take them to a new "confirm" window.
If they confirm then continue. If they do not, return to the
previous page.

Thank you for your quick response. Below is code snippet I use as
template to construct my own JavaScript code.

**

<form method="post" action="mail.php" onSubmit="javascript:return
confirm('Do you really want to send this order ?);">

**

When I include Submit button in this form form action should be
performed, e.g. "mail.php" should be executed. Only thing is that it
is executed directly without any confirm windows.

JS is enabled and browser is Firefox 2.0. What is more I frequently
use JS in my designs and this very site I am working on now has plenty
of JS included. That is a bit confusing - that code above does not work.

Did I miss something when I incorporated JS in form ?

Thanks,

Tomislav

Sorry, I don't know - I'm not that great on javascript. Try
comp.lang.javascript for javascript questions.
May 21 '07 #5
Bas Cost Budde wrote:
Uit het bericht van Jerry Stuckle:
>Tomislav wrote:
>>>
Your best bet is javascript - it works, just ensure you have
javascript enabled. Or you can take them to a new "confirm"
window. If they confirm then continue. If they do not, return to
the previous page.

Thank you for your quick response. Below is code snippet I use as
template to construct my own JavaScript code.

**

<form method="post" action="mail.php" onSubmit="javascript:return
confirm('Do you really want to send this order ?);">

**

When I include Submit button in this form form action should be
performed, e.g. "mail.php" should be executed. Only thing is that it
is executed directly without any confirm windows.

JS is enabled and browser is Firefox 2.0. What is more I frequently
use JS in my designs and this very site I am working on now has
plenty of JS included. That is a bit confusing - that code above does
not work.

Did I miss something when I incorporated JS in form ?

Thanks,

Tomislav

Sorry, I don't know - I'm not that great on javascript. Try
comp.lang.javascript for javascript questions.
(top posting fixed)
I usually catch the submit action from the submit button. Would you care
to see what that gives? The event procedure must cancel the default
action, cross-browser... let me look this one up... nah, return false
will do.
For javascript, not PHP.
Does that help enough?
No.
Yow, now I re-read your snippet, something strikes me: inside the
inline onsubmit definition, there is no need to put 'javascript:'.
Maybe that is all it takes.
Or, since this is javacript, maybe he needs to follow up in a javascript
newsgroup.

P.S. Please don't top post. Thanks.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 22 '07 #6

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

Similar topics

1
by: Hans | last post by:
Basically what I would like to do is my own confirm dialog so I can choose the text on the buttons etc. My code looks something like this today if (confirm("Do you want to save?")) //do some...
0
by: Tony Baker | last post by:
Wow. I finally found out the easiest way to display a yes/no (well, yes/cancel) dialog pop up from ASP.Net. Turnes out to be really easy. Just add the following in you Page_Load method (C# code...
2
by: Patrick Delifer | last post by:
Hi, I am trying to implement a JS confirm dialog when a user is deleting something off my Datagrid. The problem is that I don't have a Delete button in which case I could write the following...
3
by: ad | last post by:
I want user can confirm before delete records ? How can I show a confirm dialog when users press a button?
1
by: zhuang | last post by:
With Javascript, i know I could create confirm dialog in ASP.NET app.But the button is yes and cancel, is there anyway to change it to yes and no Thanks zhuang
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
1
by: =?Utf-8?B?UmFq?= | last post by:
In my user control, I have included javascript code using ScriptManager.RegisterClientScriptBlock(). JavaScript code has a confirm message dialog box and we store the message value in a hidden...
0
by: marksommerville | last post by:
Can anyone help? I have a Delete button that processes a request to delete 1 or more records. I want to be able to issue a custom javascript confirm dialog message before I go through my save...
2
by: 00steve | last post by:
Hi, I am using a confirm dialog to display a list of altered records when the user submits changes. I would like it displayed in the following format: Student ...
21
raveendrabikkina
by: raveendrabikkina | last post by:
I want the confirm dialog box with "yes/no" buttons rather than the default "ok/cancel" buttons of confirm dialog box. what is the syntax for getting that . P.S: one thing don't tell me the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.