SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

Javascript Conform delete window

Many time while deleting a record we give one warning message or a simple window message asking the user to conform once again the deleting process. Here the user can change his mind and can cancel the operation or conform his action by clicking the submit button.
We will be using one javascript function to know the user inputs so it is better to check whether javascript is enabled or kept in disabled condition. This conformation system will not work if JavaScript is disabled by the user browser. So read on how to detect javascript enable or disable condition of the user click here

The deleting process requires server side scripting language like PHP, ASP, Perl etc. We will not discuss those here and will concentrate on JavaScript part. Here is the function which takes care of this. It takes two inputs, one is the title or the message and the other is the id of the record usually used in scripts to identify and delete the record. The conform window will return with true or false condition. It true then the delete action will be done by the scripting angle. Here is the funciton.

<script LANGUAGE="JavaScript">
<!--
function confirmSubmit(ttt,id) {
var msg;
msg= "Are you sure you want to delete the data ? " + ttt + " - ID= "+id;
var agree=confirm(msg);
if (agree)
return true ;
else
return false ;
}
// -->
</script>

Here is the PHP code where records are displayed with a delete link. User can delete any record by clicking the delete link. Here some PHP code is shown as an example. Same way ASP or other script code can be used.

<a onclick=\"return confirmSubmit('$noticia[title]','$noticia[id]')\"
href='display_k.php?id=
$noticia[id]&todo=delete_k&status=$noticia[status]&by_query=$by_query'>Delete</a>


Further readings
Displaying alert window with message
prompt window for user input
Confirm window for user choice
Opening a child window
Closing child window on click of a button
Refreshing parent window from child window
Passing of data from child window to parent window
Showing a conformation window to user before deleting
Displaying JavaScript pop up window
 
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.

Scripts
PHP
JavaScript
JavaScript Tutorials
Popular Tutorials
Drop down list
Timer function
JavaScript Tutorials
String
Array
Date & Time
Form Validation
Event Handling
Math Functions
Loops & structure
JavaScript Forum
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.