onbeforeserverevent Event

             

Occurs before a form is posted to the server. Available only in client script.

Syntax

object_onbeforeserverevent(strName, strEvent)

Parameters

object

A PageObject script object.

strName

An object that fires the event.

strEvent

The name of the event.

Remarks

This event occurs before the form is posted to the server to process a client event. To cancel the posting of the form, set the cancelEvent property to True.

Note   Although this is an implicit event, only JavaScript event handlers will be implicitly called. If a Microsoft® Visual Basic®, Scripting Edition (VBScript) event handler is used, you must register the event handler with the advise method.

Example

The following is an example of how to trap the button click event for a delete button. The script prompts the user to confirm the deletion before proceeding.

<SCRIPT LANGUAGE="Javascript">
function thisPage_onbeforeserverevent( obj, event ){
if (obj=="btnDelete"){
      if(event=="onclick"){
         if (confirm("Are you sure you want to Delete?")){
            alert("Deleted per your request");
         }
         else {
            alert("Delete cancelled");
            thisPage.cancelEvent = true;
         }
      }
   }
}
</SCRIPT>