javascript to confirm to update

Results 1 to 2 of 2

Thread: javascript to confirm to update

  1. #1
    yls Guest

    Default javascript to confirm to update

    Hi, how to hava a javascript to confirm to update a record. A YES/NO popup will appear and the user has to choose yes so that the record will be updated

  2. #2
    Join Date
    Dec 1969

    Default RE: javascript to confirm to update

    Im guessing that the user has to submit a form to update the record, therefore you could do something like this:<BR><BR>in your form tag:<BR><BR>&#060;form name="dostuff" action="update.asp" method="get" onSubmit="return confirmStuff(&#039dostuff&#039, &#039are you sure you want to update?&#039)"&#062;<BR><BR>provide a function in the head of the page:<BR><BR>&#060;head&#062;<BR>&#060;script language="JavaScript"&#062;&#060;!--<BR><BR>function confirmStuff (formName, msg) {<BR> if (confirm(msg)){<BR> document.forms[formName].submit ();<BR> }<BR> else {<BR> return false<BR> }<BR>}<BR>// --&#062;<BR> &#060;/script&#062;<BR><BR>Basically the onSubmit attribute enables execution of some javascript when a user tries to submit a form. in this case we execute a function (which we pass the name of the form and the message to be displayed) which either submits the form or returns false depending on user choice.<BR><BR>Hope this helps<BR><BR>Mark Kelly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts