Javascript Alert / Popup Query On Deleting Records...

Dec 27, 2007

On some sites I have worked on, users can delete content from their site. When they go to delete an item, I take them to a page where I pull the item details of the item they are about to delete from the dbase, and say "Are you sure you want to delete so and so". They can choose Yes / No. Yes takes them to action that runs the SQL to delete the item from the dbase. No takes them to the previous page.

I have seen some sites that have managed this process differently, where, instead of being taken to another page, a little pop up box opens saying "Are you sure", with a Yes / No option on it. Yes takes you to delete the item, No leaves them on the page they are on.

Am I right that this method uses Javascript? I know that it won't work if javascript is turned off, but - most people don't turn it off...

View 7 Replies


ADVERTISEMENT

Alert Box Popup To Confirm Before Deleting Entry?

Jan 25, 2010

I am working on a PHP web application for my company and have run into a problem with Javascript. In a list I am displaying from a Mysql database, I have the option to delete certain entries. Before someone deletes an entry though, I want them to have an alert box pop up and asked then if they are sure. I have this simple javascript function in the head of the page, but whether cancel or ok are pressed, the page refreshes to the link. How can I fix it so that if you press cancel, nothing happens, other then the alert box goes away, but also allows the link to process if OK is pressed?

HTML Code:
<script type="text/javascript">
function show_confirm(){
var r=confirm("Press a button!");
if (r==true){
alert("You pressed OK!");
}else{
alert("You pressed Cancel!");
}}
</script>

View 7 Replies View Related

JQuery :: Deleting Records With Classic ASP

Mar 8, 2010

I'm using jquery to pass trough data to another page where I want to insert and delete a record. But the problem is that jquery only inserts or deletes the records and not both together. I use following code:
For jquery:
$(document).ready(function(){
$("#btnAddPayment").click(payment);
});
//example 1
function payment(){
$.ajax({
type:"POST",
url: "acceptPaymentExecute.asp",
dataType: "application/x-www-form-urlencoded", .....

objRS = objConn.execute(strInsertPayment)
objRS = objConn.execute(strDeleteMemberPayment)
objRS.close()
set objRS = nothing
objConn.close()
set objConn = nothing
The queries work but not together. If I comment the insert statement, my page executes the delete statement. I already tried to call another object for my delete statement but it does the same.

View 4 Replies View Related

Deleting Selected Records For PHP Program?

Aug 17, 2011

I want javascript function to delete the selected records for the given php program below. Also I am not getting field values in correct order one field is more than its field.

Code:
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="test"; // Database name
$tbl_name="emp"; // Table name

// Connect to server and select databse.
mysql_connect($host, $username, $password)or die("cannot connect");
mysql_select_db($db_name)or die("cannot select DB");
$sql="SELECT * FROM emp";
$result=mysql_query($sql);
$count=mysql_num_rows($result); .....

View 3 Replies View Related

Javascript Anthology Popup Query

Apr 20, 2007

I have used the code from Sitepoint Javascript anthology (page 130) to create a popup on my pages, however I have a list of pdfs each of which needs to open in a popup and the code only works with the very first in the list. the rest of the pdfs open up in the window as normal. How can I adapt this and would I have to separatly number each id: ?

View 1 Replies View Related

Query :: Display Results With Alert Message?

May 16, 2010

I'm relatively new to jQuery, and I don't understandy why the following doesn't work. Hopefully, you can enlighten me. I declared a variable: var currHive = $("#masterHive") .find("div.currentHive"); Now I want to see if the query returned the correct element id. So, I tried each of the alert messages shown below, one-at-a-time. This is the strategy I am using to verify the code; i.e. do something, then tell me what I did.

$(document).ready(function(){
var currHive = $("#masterHive") .find("div.currentHive");
alert(currHive).attr(id);/* returns object Object */
alert(currHive.id);/* returns undefined */
alert(this.id);/* returns undefined */
alert($(this).attr('id'));/* returns undefined */
});

Note: I have successfully used --- alert($(this).attr('id')); --- in an experiement to tell me which button was clicked, in a statement using the .bind() method.

View 2 Replies View Related

Sorting An Array Of Records By Value Of Field In Records?

Nov 2, 2009

I have written this program:

var scores=[];
function sortScores(scoreRecs){
for(i=0;i<scoreRecs.length;i++)

[code]...

to take an array of variables in calling the function (ie sortScores), place these variables into an empty array("scores"), apply the bubble sort to scores, and then alert scores in sorted form. When I use test values like I have above, where they are all just numbers, this program works perfectly and alerts the "scores" array, correctly sorted. However, what I would like to do is to call the function with an array of records, each containing two fields, and apply the same sort to the array of records, based on the value in the first field of each record.To illustrate, i'd like to be able to call the function thus:

sortScores([{score:0,index:0},{score:2, index:1},{score:1,index:2}]);

and for it to sort the records in descending order of the value of the "score" field. So the above call would alert:

[{score:2,index:1},{score:1,index:2},{score:0,index:0}]

however, i'm not sure how i'd reference the numeric part of the f1 of each record in the sort?

View 3 Replies View Related

Pass Query String Using Popup

Jul 23, 2005

What I am attempting to do is have a link/button on a page
(testpopup.cfm) that opens a popup page (popupwindow.cfm). The popup
page displays a resultset from a query and the selected record needs
to be passed through a query string/URL parameter to the original
calling page and will be available in the body onload event of the
calling page.

I open the popup window and display the query results, I then click on
a record and the record is then displayed in the calling form textbox
(txtOrg) - - - only the calling form appears in the POPUP window!
This is not what I need it to do. I need it to pass the URL parameter
to the calling page and close the popup. Here is the code from the
two pages. Can you shed any light on this? ....

View 1 Replies View Related

Deleting The Last Row In A Dynamic Javascript Table

Feb 17, 2006

I have this dynamically created table in my one of my php forms
that shows the names of the people the user has entered into a text
field. When they hit add a row displays, showing the name they entered.
Also, an image that allows them to delete shows beside the name upon
creation.

The delete removes the name from the table and pushes the
other names to the top. Simple stuff, however, if I delete the last
name displayed(the bottom of the table), then the next, then the next,
IN ORDER, I have no problems. If I pick a name that is in the middle or
top of the table, everything below does not allow me to delete Code:

View 5 Replies View Related

Cf And Javascript W/ Database Query

Dec 27, 2004

i'm having the user input their state (from a drop down list) and type in a zipcode (there are 1,143 zip codes in the database to match to)..

what i want to happen is once the user selects the state they live in, and type in a zip code, i need the page to query the database if the user selected Ohio, and match the counties in the database with the zip code they entered, and then create a drop down list of the counties for them to select the one they live in Code:

View 1 Replies View Related

Query Parameters At The End Of The JavaScript File

Aug 10, 2007

I am starting to find more web pages that are using a query parameters
after the JavaScript file.

Example can be found at www.opensourcefood.com. Within the source
you'll see: <script src="/shared/scripts/common.js?revision=1.6"
type="text/javascript">.

I am trying to see if there is any big deal to this or a best practice
that is starting to creep up in the JavaScript community. If this is
used only as a way to distinguish what file of JavaScript being used
why not append something inside the file? Has anyone else seen this
or know of more reasons to do this?

View 17 Replies View Related

Alert And Popup Not Showing In IE?

Sep 14, 2009

I've been using a javascript confirm() box on submission of certain forms (i.e. when deleting a record) but I cannot get any popups to work in IE7. Even the simplest:

<script type='text/javascript'>alert('Test');</script>

In the <head> of the page isn't working. All my other browsers show it perfectly, including IE6.Is this to do with the security settings of IE7?

View 2 Replies View Related

Alert Images - Get Darkened And A Popup Box

Aug 22, 2011

I've seen several sites that use what looks like the alert function (I know it isn't), where the site gets darkened and a popup box (similar to that of the alert one) comes up and displays an image (and only an image)

View 2 Replies View Related

Show An Alert / Popup Msg To User?

Jul 2, 2009

How do I show an alert/popup msg to the user if (items.Count < 1)?

View 3 Replies View Related

Popup Alert On Selecting A Checkbox?

Jul 1, 2010

I want to display a Popup alert if select all checkbox is selected and number of rows in the grid are more than the number of check boxes selected. This code does that but it does on the second click on the select all check box, not on the first click.correction:

Code:
<script type="text/javascript">
var TotalChkBx;

[code]....

View 4 Replies View Related

JQuery :: Popup Alert Comes Before My Images On My Page

Jun 21, 2009

jQuery,<div>

That the page was finished loading? but what I see is that the popup alert comes before my images on my page.....

finished loading? is this correct?

I need to do something to my page when everything is done loading.. how does one do that.

View 3 Replies View Related

JQuery :: Popup Alert When Leaving Website Via A Link?

Jan 13, 2012

I am using an alert dialog function I found online. The support for it has closed.Here is the page showing my alert button:Click here to view my test pageYou can check out the source html and the linked jquery files.The alert button works correctly by displaying an alert box.How do I apply this same behavior to a link?I want a user to click on the link, and:(1) receive the message they are leaving the site, then(2) be redirected to the other URL.

View 7 Replies View Related

Popup Alert When User Browse File Into Input?

Sep 18, 2011

I want to pop up alert when the user browse file into input for example I have this input:
HTML Code:
<input type="file" name="myfiles[]" />
Now, when the user finish to browse an file I want a function to start working, what I mean by finish browse file is when the user select file and than click on the file he selected twice and than when the browsing files windows close I want this function to start.

View 3 Replies View Related

Timing - Show One Fixed Popup - Like Message Alert Box

Mar 12, 2010

This script show one fixed popup ( like message alert box ) Now i want show it after 10 minutes.

Code:

View 5 Replies View Related

Pressing The Enter Key Submit Page More Than Once - Both Alert Popup Boxes Appear

May 31, 2010

Pressing the enter key of the following page (created by JSP) submit page more than once.

Both alert popup boxes appear as expected:

However, then this alert appear again, which is unexpected:

But alert('alarmgroup ' + alarmgroup + ' rowsPerPage ' + rowsPerPage); do not appear.

View 1 Replies View Related

Javascript To Submit To A Page To Edit Item From List Returned From A Database Query.

Feb 23, 2006

I am making a webpage that can query a database table of employees
and return them in a html table. Currently I have submit buttons beside
each employee to open the page to edit their details. I have been using
php/HTML to do this, but wondered if it is safe to use javascript to
just click on the name of the employee to jump to the edit page. I've
been looking on the web for sometime about how to do this without any
luck. Any thoughts?

View 1 Replies View Related

Check If The Visitor's Browser Has Enabled The Option To Print Background Images And If Not To Popup An Alert?

Mar 24, 2011

Is it possible for Javascript to check if the visitor's browser has enabled the option to print background images, and if not to popup an alert?

View 1 Replies View Related

Setfocus After Alert In Javascript

Jul 20, 2005

I have a text box, after user input the value, a validate function
trigered. if the value is invalid, alert display, and also set focus
back to this control.

The alert displays, but when the click the 'OK' in the alert, the set
focus to this field does not work. see the code bellow:

if (run!="" && IsNumber(run)==false && decimalinputvalid(run,2)==0 )
{
alert('wow');

//first try doen not working
(setFocus) ? document.papercaltbl.printorder.focus() : ""

//seconde try doen not working
this.getField("printorder").setFocus();

//third try doen not working
document.getElementById("printorder").focus();
}

View 1 Replies View Related

JavaScript Disabled Alert

May 21, 2006

I have a form that uses javascript for validation and cost calculating to place an order.

If someone has their javascript disabled, they will be able to submit the form, but without the cost figures showing up.

I want to prevent the user from submitting the form, but alert them that they need to enable JS to fill in/submit the form?

Is this possible? What do I need?

View 5 Replies View Related

Alert If Button Pressed - It Should Give An Alert That The Alert Is Not Checked?

Oct 21, 2011

heres my code:

Code:
<script language="JavaScript">
var checkobj
function agreesubmit(el){[code]....

i need to make it like if the button is clicked and there the agreement checkbox is not checked.. it should give an alert that the alert is not checked.. i know that would require a if and else statement but i cant figure out how to do it

View 3 Replies View Related

Need To Cancel A Javascript Alert/confirm Box

Jul 23, 2005

A description of the problem:
1) Go to a page with various settings and a timeout (forces re-login
if over 10 minutes)
2) Before the timeout, make some changes to settings.
3) Press a "reset to defaults" button that uses a confirmation box to
let the user know what is about to be reset (lists items).
4) Walk away while the confirm box is displayed and come back after
the page timeout.
5) My screen now has the page, a confirm popup on top of that, and a
timeout alert on top of that.
6) Press OK to dismiss the timeout alert. The underlying page goes to
the login screen, but the confirm box remains.

How can I clear any javascript alert/confirm popups in this situation
automatically?

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved