Current location: Hot Scripts Forums » General Web Coding » JavaScript » confirm submit


confirm submit

Reply
  #1 (permalink)  
Old 07-08-09, 05:32 AM
gilbertsavier gilbertsavier is offline
New Member
 
Join Date: Jul 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
confirm submit

Hi there,

I want to update my form that makes me delete items from my site.

The nw part should be a alert to confirm the submit. I got it this far:

Code:
HTML Code:
<script type="text/javascript">
function areyoureallysure()
{
var messageb = "Are you sure?";
if (confirm(messageb))
	return true;
else
	return false;
}
</script>
PHP Code:
<?
echo"
<form id=\"BestellingVerwijderen\" action=\"details.php\" method=\"post\" name=\"BestellingVerwijderen\" enctype=\"multipart/form-data\">
    <input type=\"hidden\" name=\"n\" value=\"$n\">
    <input type=\"hidden\" name=\"d\" value=\"d\">
    <table width=\"500px\" border=\"0px\" cellspacing=\"0px\" cellpadding=\"5px\">
        <tr>
            <td align=\"center\" class=\"groen\" colspan=\"2\">            
                <a href=\"javascript:areyoureallysure();\" class=\"pointer\">
                <font color=\"red\">Klik hier om deze uitgave te verwijderen.</font></a>";                        
            echo"</td>
        </tr>
    </table>
</form>
";
?> 
The alert is there.. but no mather what I click (cancel or aprove) it will return to the page it comes from
instead of further submit the form and delete the part I wanted to....

-----------------------
Thanks & regards
Lokananth

Last edited by Nico; 07-08-09 at 06:31 AM.
Reply With Quote
  #2 (permalink)  
Old 07-08-09, 09:13 AM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
PHP Code:

<script type="text/javascript">
function areyoureallysure()
{
var messageb = "Are you sure?";
if (confirm(messageb))
    return true;
else
    return false;
}
</script>
PHP Code:
<?
echo "<form id='BestellingVerwijderen' action='details.php' method='post' name='BestellingVerwijderen' enctype='multipart/form-data' onsubmit='return areyoureallysure();'>
       <input type='hidden' name='n' value='
$n'>
       <input type='hidden' name='d' value='d'>
       <table width='500px' border='0px' cellspacing='0px' cellpadding='5px'>
        <tr>
         <td align='center' class='groen' colspan='2'>
          <input type='submit' value='Klik hier om deze uitgave te verwijderen.' style='color:#f00;border:none;background:none;text-decoration:underline;cursor:pointer;'>
         </td>
        </tr>
       </table>
      </form>"
;
?>
__________________
Jerry Broughton
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
confirm submit jonnekke HTML/XHTML/XML 1 06-03-09 06:02 AM
submit buttons? godonholiday JavaScript 5 08-24-06 11:12 AM
Submit form automatically - not the submit button INTEL JavaScript 12 12-07-05 06:09 AM
submit form with more than one href submit and no submit button adlinfanus JavaScript 1 03-09-04 06:45 AM
3 submit buttons, I want one of them to be used when hitting enter. blasto333 HTML/XHTML/XML 2 02-21-04 03:24 PM


All times are GMT -5. The time now is 01:53 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.