JavaScript - Confirmation Box And Php
I have an action in PHP where, when a user clicks the delete button i want a confirmation box. How does a confirmation box work with a PHP function. Here is the function.
Code: <a href="/order/delete/id/<?php echo $o->id?>"><img src="/gfx/trashicon.gif" /></a> Any help would be appreciated! Similar TutorialsHello I have an adult website and I want an "adult message" to be display when people go to my website, something like this: http://www.latincaramelito.zoomshare.com/ i already tried some codes that i found here but they dont seem to work, the codes a first one: <script> if (!confirm("Do you want to enter this site?")) window.location=history.go(-1) </script> Second one: <html> <head> <script type="text/javascript"> var stay=confirm("The following site contains appalling material suitable only for webmasters. Please 'ok' to enter, 'cancel' to exit immediately!") if (!stay) window.location="http://www.yahoo.com" </script> </head> <body> Appalling material here </body> </html> help me plz, thank you Would greatly appreciate any help with this. Have made a contact form for a website that uses javascript to validate it then once validated prompts the user if the details are correct. Currently its working in chrome and ie but not in firefox. Code is in post #3.
Ok I know there are a few other posts about this but I can't find one similar to my problem. The confirmation box pops up, but cancel does nothing. it is for deletion of a movie off a server for class, but if you hit cancel it deletes the entry anyway. here is my code: Code: <script type="text/javascript"> function show_confirm() { var r=confirm("Are you sure you want to delete?"); if (r==true) { window.location="movie_delete.cfm?FilmID=#FilmID#"; } } </script> [<a href="movie_delete.cfm?FilmID=#FilmID#" onclick="show_confirm()">Delete</a>] notice anything wrong? Hello, How can this be made to return confirmation? <form id="score_form" method="post" action="addscore.php"><input id="score" name="score" value="" type="hidden"><img id="collect" style="cursorointer;height: 37px; width: 100px; margin-top: 13px;" src="./collectlive.gif" onclick="collect_points();"></form> Letsay the confirmation window would say"ARE YOU SURE" Hi Everyone, Has anyone noticed the twitter confirmation box (when you hit save in Settings, the page refreshes and a white confitmation box appears along the top of the screen and disappears again in a few seconds)? Does anyone know how to go about implementing this? My JS skills would not be the best. I wonder is there a jquery plugin that I could use or similar? Thanks in advance, Brian I have created a button with a window.confirm() method but when I click on it in firefox the dialog box does not appear. It does however appear in all the other browsers
Hi all, I want to have a javascript popup box so that when a hyperlink is clicked, a user is asked if they are sure they want to click this link, if they select ok then the page loads, if they click canel then nothing happens, so i have this code below: Code: <script type="text/javascript"> function confirmSubmit() { var agree=confirm("Are you sure you wish to click this link?"); if (agree) return true ; else return false ; } </script> Code: <a onclick="return confirmSubmit()" href="page.html">Page</a> However when a user clicks cancel the link still loads, can anyone see where I am going wrong? any help will be appreciated i hava e java script fr confrmation of record deletion on server side in asp.net function deleteCheck() { if (document.getElementById('H_ctrl').value!="") { alert(document.getElementById('H_ctrl').value) var delconfirm = confirm('Are you sure ? You want to delete ' + document.getElementById('H_ctrl').value +' Details ?') if (delconfirm==true) { var delconfirmAgain = confirm('The Record ' + document.getElementById('H_ctrl').value +' will be deleted permanently. Are you sure? ') if(delconfirmAgain==true) { return true } else { return false } } else { return false } } } BTNDELETE.Attributes("onclick") = "javascript:return deleteCheck();" in the button event i have a query for redord deletion i need to delete the records if u use the return keyword the record doesnot get deleted but if i remove the return keyowrd the record gets deleted even if CANCEL is clicked Hi, My code below shows a list of Qualifications and a Delete (Remove) button I would like to show the Qualification name not the setting_id my problem is that I am not passing the Qualification name through in the form... Can someone please help me? JavaScript Code: function confirmqualification() { var SettingID = document.getElementById('setting_id').value; var answer = confirm("Delete entry "+SettingID+" ?") if (answer){ alert("Qualification Deleted") window.location = "delete_qualification.php?&setting_id="+SettingID; } else{ alert("No action taken") } } html Code: <fieldset> <legend>Qualifications </legend> <select name="setting_id" id="setting_id" size="7" style="width:100%;"> <?php while($row1 = mysql_fetch_array($result)) { echo '<option value="'.$row1['setting_id'].'">'.$row1['qualification'].'</option>'; } ?> </select> <input type="button" name="remove" id="remove" value="Remove" onClick="javascript:confirmqualification()" /> </fieldset> Hi, I am trying to make an entry confirmation form. This is going to be used as a disclaimer for my website. How can I make this to where it only shows on the main page and not every page a user goes to on my website? <script> var enter=confirm("examples insert text") if (!enter) window.location="http://www.google.com" </script> I have a js confirmation function: PHP Code: function r_u_sure(message, url){ if(confirm(message)) location.href = url; } if I were calling this function with a regular href, I would use the following: PHP Code: <a HREF="javascript:r_u_sure('Are Sure You want to Delete or Modify Car Information?!','www.somewhere.com)"><a/> however my html link which begins the deletion process of a records opens a popup box that performs. the link is the following: PHP Code: <a onmouseover='this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick="document.getElementById('PopUp10').style.display = 'block' \"><span><img border='0' src='../images/editcar_info.png' width='40' height='40' title='Delete or Modify Car'></span></a> Any thoughts on how can conbine both so that onclick of the link, first, the confirm box appears, if "ok" is selected, the pop up box will open, else the dialogue box closes and nothing happens. Mossa-- Hello all, Im new to the board, Have a question i cant figure out. This board seems very helpful, so here goes. Im trying to grab certain variables like orderID & Subtotal variables that are posted to the confirmation page. The reason im grabbing these is for a confirmation pixel that is displayed for commission junction. When some clicks on their link, then completes an order, their tracking pixel fires grabs these variables and that way they can track the order confirmaton. The problem is they dont see the tracking pixel firing and its not grabbing the variables. I dont know what to do. Here is the code. maybe someone here can help me?? This is the code that shows on the confirmation page. Im assuming this is where im suppose to grab the variables. Code: //<![CDATA[ var SecureCartOrders = [ {"orderID":154983165,"name":"Max Test","company":null,"email1":"max@maxtest.com","address1":"123 main st","address2":null,"city":"miami","state":"Florida","zip":"33845","country":"United States","fax":null,"phone":"5611112222","secondaryphone":null,"cardtype":"","shipname":"Max Test","shipCompany":null,"shipAddress1":"123 main st","shipAddress2":null,"shipCity":"west palm beach","shipState":"Florida","shipZip":"33405","shipCountry":"United States","status":"Accepted","product":["oil product"],"sku":["FC1246"],"quantity":[1],"price":[0.00],"option":[[]],"productattributes":[{}],"plist":"3598071","Total":0.00,"shippingMethod":"Free Shipping","shippingAmount":0,"grandTotal":0.00,"adtrack":0} ]; //]]> This is the javascript code that im using to grab those variables. The variables that i need are orderID & Total Code: <script type='text/javascript'> var orderId = SecureCartOrders[0].orderID; var subTotal = SecureCartOrders[0].Total; var url ='https://www.emjcd.com/u?CID=111111&TYPE=343000&CURRENCY=USD&METHOD=IMG'; url += '&OID=' + orderId; url += '&AMOUNT=' +subTotal; document.write('<img width=\'20\' height=\'1\' src=\' + url + \'\'>'); </script> I have no idea what else i can do. This is a system hosted confirmation page from a shoppingcart software called, 1shoppingcart.com Hi friends, I am trying to use the window.setTimeout feature so that a message pop-up with yes/no appears on the screen asking whether to extend the session. The actual sessions expires on 5 seconds. *If yes is clicked, the current page reloads. *If no is clicked, nothing happens. (the session will expire anyway). Many pages is open fastest, but other delays several seconds or minutes! Quote: var w = 800; var width = 800; var h = 800; var height = 800; var left =(screen.width/2)-(w/2); var top = (screen.height/2)-(h/2); window.open ("","myNewWin", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); var a = window.setTimeout("document.form1.submit();",5000); Letchev Here's the code. what am I missing to make this work? Thank you in advanced! @if (Model.Layer.Id > 0){ <div style="float: left; padding-left: 14px;"> @using (Html.BeginForm("Delete", "Layer", new { layerId = Model.Layer.Id, subAccountId = Model.SubAccount.Id })){ <input type="image" src="/Portal/Content/images/admin-delete-off-btn.png" onmouseover="this.src='/Portal/Content/images/admin-delete-on-btn.png'" onmouseout="this.src='/Portal/Content/images/admin-delete-off-btn.png'" title="Delete button" value="Delete" alt="Delete" /> } </div> } <div class="clear"></div> <div id="dialogDeleteBox" title="Delete Confirm" style="display: none"> <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 40px 0;"></span> <div id="confirmDeleteLayer"> <div id="confirmDeleteLayerMessage"> <p> Are you sure you want to delete this group? </p> </div> </div> </div> can anyone help me change this script to add confirmation of finishing the exam when pressing submit button and avoiding that when time is out....and how could i save radio button checked even if page being refreshed it stays checked....thanks in advance. this is the code.... Code: <?php if($_POST['submit']) { print_r($_POST); $aqeel= $_POST['q']; print "a ".$aqeel[2]; exit(0); } ?> <?php //Function to generate/fetch the exam //Example output of the function: $examQuestions = " <label for='q1'>What is your name?</label><input type='text' name='q[1]' id='q1'><br /> Are you:<label for='q2a'>Male</label><input type='radio' name='q[2]' id='q2a' value='male'> or <label for='q2b'>Female</label><input type='radio' name='q[2]' id='q2b' value='female'><br /><input type='text' name='c'> "; //Set a variable in the format: 'h, m, s' for use as the timer paramiters //Sample: $timerLength = '0, 0, 10'; //0 hours, 0 minutes, 10 seconds ?> <html> <head> <script language='javascript' type='text/javascript'> function timerShow(hours, minutes, seconds, init) { if(init === true) { setTimeout("timerTick(" + (hours * 360 + minutes * 60 + seconds) + ")", 1000); } if(hours > 0) { time_left = hours + " hr:" + minutes + " min:" + seconds + " sec"; } else { if(minutes > 0) { time_left = minutes + " min:" + seconds + " sec"; } else { if(seconds > 0) { time_left = seconds + " sec"; } else { document.getElementById("submit").click(); } } } document.getElementById("timer").innerHTML = "Time Remaining: <b style='font-size: 14pt; color:red;'>" + time_left + "</b>"; } function timerTick(seconds) { seconds -= 1; if(seconds > 0) { setTimeout("timerTick(" + seconds + ")", 1000); } hours = (seconds - (seconds % 360)) / 360; seconds -= hours * 360; minutes = (seconds - (seconds % 60)) / 60; seconds -= minutes * 60; timerShow(hours, minutes, seconds, false); } </script> </head> <body> <div> This exam consists of <b><?php echo $num_q; ?></b> questions.<br /><br /> You have <b></b> minutes to complete this exam.<br /><br /> <input type='button' onclick='this.parentNode.style.display = "none"; document.getElementById("exam").style.display = ""; timerShow(<?php echo $timerLength; ?>, true);' value='Start'> </div> <form id='exam' method='post' style='display: none;'> <div id='timer'></div> <?php //output the exam here echo $examQuestions; ?> <input type='submit' value='Finish' name='submit' id='submit'> </form> </body> </html> Hi! Trying to get a delete confirm dialog box to open when you click on the button. Here's what I have in the body... @if (Model.Layer.Id > 0){ <div style="float: left; padding-left: 14px;"> @using (Html.BeginForm("Delete", "Layer", new { layerId = Model.Layer.Id, subAccountId = Model.SubAccount.Id })){ <input type="image" src="/Portal/Content/images/admin-delete-off-btn.png" onmouseover="this.src='/Portal/Content/images/admin-delete-on-btn.png'" onmouseout="this.src='/Portal/Content/images/admin-delete-off-btn.png'" title="Delete button" value="Delete" alt="Delete" /> } </div> } I can't seem to figure out the script to make this work. Can anyone help? What I had was <script type="text/javascript"> function confirmDeleteSelected(id) { jQuery("#dialog-confirmDelete").dialog({ closeOnEscape: false, resizable: false, width: 250, modal: false, zIndex: 5000, buttons: { "Yes": function () { doDeleteSelected(id); jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); }, "No": function () { jQuery(this).dialog("close"); jQuery(this).dialog("destroy"); } } //end Buttons }); } </script> Thanks Phil Code: <fieldset class="submit" style="padding-left: 200px;"> <?php if ($site_exist >= 1){ echo "<input type=\"submit\" name=\"submit\" value=\"Update\">"; } else { echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";} ?> <!-- This is the button I am having trouble with. --> <input type="button" name="delete" value="Delete" onClick="return confirmSubmit()"> </fieldset> </form> <script type="text/javascript"><!-- function confirmSubmit(){ var agree=confirm("Are you want to delete this site from our index?"); if (agree) return true ; else return false ; } // --> </script> Not entirely sure which forum this should go in, since the problem could probably be fixed with HTML, PHP or Javascript. Anyway, I have the confirmation window working. What I need is for the button to post a variable (siteDelete = 'true') when it is pressed. I would prefer to do that part without javascript, but I want the data to be posted after and only after the confirmation window returns true. I can do that with a submit button, but I'm not sure what code to use and where to use it when using a non-submit button. |