RE: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Jonathan Hilgeman

You're so negative, Jason. :)

Long answer, Dave, it wouldn't be wise to do this via Javascript. Javascript
can be turned off and also varies from browser to browser (like any
client-side language/scripting), so this raises an issue of reliability. You
may be able to do it if you're working on an intranet where you know that
all users have the same browser, have Javascript turned on, and don't have
access to turn it off, OR if this is for your own use and you don't want to
make it screw up. Otherwise, it might be a nice feature, but you shouldn't
rely on it.

If you WERE going to do it, I would have your main form have a hidden input
called Confirm and set it to a value of 1. Then, have a Button (not a
submit button) use Javascript to open a new browser/popup window (you can
format it to look like a regular Yes/No windows popup box). Have the Yes
I-want-to-delete-this-record button change its parent window's form and
change the Confirm input's value to 0 and submit the parent window's form
in order to delete the record. Have the No button just close the popup/new
window.

Now, on the page that actually deletes the record, first check the Confirm
variable. If it is set to 0, then you can figure that the Javascript set it
to 0, and you can go ahead and delete the record without asking. Otherwise,
show a regular HTML screen that asks if you really want to delete this
record (no Javascript this time), so you can be covered if Javascript gets
turned off. 

This is by no means a fool-proof method, and you should think carefully
through all this before implementing a Javascript solution, but I find that
there are better methods with PHP. For instance, you can have 3 checkboxes
side-by-side that can act as the
yes-I-really-really-want-to-delete-this-record safety. PHP can check to
see if all 3 checkboxes were checked, and then you can know that the user
was intentionally trying to delete that record, and you can go ahead and
delete it - no Javascript needed. :)

As far as the Javascripting goes, though, I would check out some JS forums
for help on how to set up the actual scripting part of the popup box. But,
as Jason probably was thinking, Javascript is never a very good thing to use
with things that are delicate, fragile, or valuable in any way. It's like
hiring an ex-thief to help you move - you can never be SURE that
everything's going to be there in the end.

- Jonathan

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 12:45 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Pop up are you sure...


On Monday 01 April 2002 16:44, Dave Carrera wrote:
 Hi All



 How do you do this?

Use javascript.

 On click of button to delete a record make a popup yes / no box appear.
 On yes then do it else stop.



 Is it possible to do with out using JS?

Short answer, no.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Timing must be perfect now.  Two-timing must be better than perfect.
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Jason Wong

On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

My long answer was going to be: it's possible to do it in PHP, but then it 
would not look like a pop-up window, and it requires a trip back to the 
server.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Love is being stupid together.
-- Paul Valery
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Jonathan Hilgeman

shrug I was close. :)

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 01, 2002 10:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Pop up are you sure...


On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

My long answer was going to be: it's possible to do it in PHP, but then it 
would not look like a pop-up window, and it requires a trip back to the 
server.


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
Love is being stupid together.
-- Paul Valery
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Dan Brunner

Hello!!

What I was able to do was this

On every form page I have, I have a checkbox that is labeled Ok To 
Save, that the user would check or not..

I would then pass that variable to the next page and check to see if the 
value was true or not...

If it is true then it would continue to insert the data into the 
database...

If not then it would display the pop up messages

The code looks something like this on the parse page.(in my case it 
is the insert3.php file)

?php

if (empty($save)){
?
script language=JavaScript
!--
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
//--
/script
/head
body bgcolor=#FF text=#00 onLoad=MM_popupMsg('Hello!! 
You Forgot to check---OK TO SAVE??---. This check is for when you 
accidently hit return or enter...This will keep a Database 
Happy!!!\n\nThank youADMIN')

?
echo (Click you back button please!!! We Have a Problem!!\n);
echo (/body\n);
echo (/html\n);
exit();
}


require (functions/java.inc);
echo (/HEAD\n);
echo (BODY BGCOLOR=#FF LINK=#FF VLINK=FF ALINK=00FF00 
Text=#00);

?

It will popup a messages about not checking that checkboxAnd tell 
you have an error...

I too messed around trying to just using PHP, but I gave up using just 
PHP, Javascript plays nice with PHP anyway!!



Dan











On Monday, April 1, 2002, at 12:57 PM, [EMAIL PROTECTED] wrote:

 shrug I was close. :)

 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 01, 2002 10:53 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Pop up are you sure...


 On Tuesday 02 April 2002 01:30, Jonathan Hilgeman wrote:
 You're so negative, Jason. :)

 No, my answer was just short and to the point ;-)

 Long answer, Dave, it wouldn't be wise to do this via Javascript.

 My long answer was going to be: it's possible to do it in PHP, but then 
 it
 would not look like a pop-up window, and it requires a trip back to the
 server.


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 Love is being stupid together.
   -- Paul Valery
 */

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread Dave Carrera

Hi all,

 

Thank you all for you advice.

 

I am aware of the two ways of achieving the required result ie: JS and
extra button built into my script.

 

But wouldn't it be nice to have a class or function we could all use
built in to php that would let us do this.

 

C,C++,Delphi and JS allow you to do this.

 

I have come across various probs with JS on client systems so I shy away
from it.

 

Again thank you all for your advice.

 

Dave Carrera

Php Developer

http://davecarrera.freelancers.net

http://www.davecarrera.com

 

 




Re: [PHP-DB] Pop up are you sure...

2002-04-01 Thread php3

Addressed to: Dave Carrera [EMAIL PROTECTED]
  [EMAIL PROTECTED]

** Reply to note from Dave Carrera [EMAIL PROTECTED] Tue, 2 Apr 2002 07:23:43 
+0100

 But wouldn't it be nice to have a class or function we could all use
 built in to php that would let us do this.



 C,C++,Delphi and JS allow you to do this.


Over the web?  The limitation is in HTML not PHP.




 I have come across various probs with JS on client systems so I shy away
 from it.


Good move!



Rick



Rick Widmer
Internet Marketing Specialists
http://www.developersdesk.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php