SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 21st, 2004, 03:50 PM
coders4hire coders4hire is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Greenwood, IN, USA
Posts: 1 coders4hire User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Simple yes/no terminate

My apologies, this is a very elementary question. I have a 'delete' and 'edit' link on my page which work. They post the type and id to a new page and subsequently either delete the record or have a form which the record can be edited in.

BEFORE posting to the page, I would like to add a message box question, "Are you sure you want to delete $id?". If the person answers YES, it posts to the next page. If they answer NO, it exits. Sort of like in PHPMyAdmin when you click DELETE on a record.

Thanks,
Doug


Reply With Quote
  #2  
Old April 21st, 2004, 04:55 PM
brut brut is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 367 brut User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Simple yes/no terminate

You want the confirm() function. Here it is in a usable form:
Code:
function confirmit(){
    if(confirm('Are you sure?')){
        return true;
    }else{
        return false;
    }
}

Then on your submit button, add:
Code:
onclick="return confirmit();"

Reply With Quote
  #3  
Old April 21st, 2004, 11:54 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: Simple yes/no terminate

brut's first javascript function was right. But I doubt whether it will work if you place onClick command on submit button.
I call it on <form> onSubmit event. ex:
Code:
<form name="frm" method="post" action="process.php" onSubmit="return confirmit();">

Reply With Quote
  #4  
Old April 22nd, 2004, 12:22 AM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Simple yes/no terminate

The onClick event can be called from EITHER the form tag OR the Submit button!!! but the poster seems to be using links and wants the id displayed as well, so the confirm would need to be called from the link like so.

<a href="delete.php?id=<? echo $id_to_delete;?>" onClick="return confirm('Are your sure you want to delete ' + <? echo $id_to_delete;?> + '?')">delete</a>


Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Simple yes/no terminate


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway