Hi Everyone,
I am using javascript code for removing some records. When i am click on delete selected button. I want this should demand one confirm button in which i want if we click OK in confirm box then the record should be removed from database and if i will click on CANCEL button then it should not be removed that record.
I have used some code for this but in this case when i click on CANCEL button after that this is also removing records that i does not want.

So i am sending code for javascript which i am using for this. Please help me what code i should use for this application.

here is code which i am using:----

function validate()
 var confirmMessage="Are you sure to Delete these Details from Database ! " ;

	 return false;

and this is delete button which i am using in my code: <input name="Delete" type="submit" class="footerlink" value="Delete Selected" onClick="return validate()"> Please help me what javascript code i should use for this. It is very urgent for me.

8 Years
Discussion Span
Last Post by mail2saion

Do it this way:

<script type="text/javascript">
function validate( form ) {
   if ( !confirm("Are you sure to delete these details from database?") ) {
      return false;
      } else { return true;
// -->

<form action="process.php" method="post" id="form1" onsubmit="return validate( this );">
<input type="submit" value="submit" id="sbm" name="sbm" />

that's way over-complicated the function. You don't need to pass the form and you don't need if-blocks

function validate()
  return confirm("Are you sure to delete these details from database?");
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.