Skip to main content link. Accesskey S

The useful resource for IBM Lotus Domino XPages development

Submit Search

Available in the Appstore!All the content of xpageswiki.com for iPhone or iPad for offline access.

Home > Server JavaScript > Work with events

Work with events

ShowTable of Contents
aIn short, the events of a XPage with two custom controls (controlA and controlB) are executed in the following order:

events executed once



  • Xpage -> beforePageLoad


  • controlA -> beforePageLoad


  • controlA -> afterPageLoad


  • controlB -> beforePageLoad


  • controlB -> afterPageLoad


  • Xpage -> afterPageLoad


events executed on a full or partial refresh



  • Xpage -> afterRestoreView


  • controlA -> afterRestoreView


  • controlB -> afterRestoreView


events executed sometimes on a full or partial refresh



  • Xpage -> beforeRenderResponse


  • controlA -> beforeRenderResponse


  • controlB -> beforeRenderResponse


  • Xpage -> afterRenderResponse


  • controlA -> afterRenderResponse


  • controlB -> afterRenderResponse


tipps


Place code to execute once when the page is initially loaded to PageLoad.
Place code to execute on every refresh to afterRestoreView.
Note that the afterPageLoad event of the XPage is executed AFTER all component's afterPageLoad events.

Taken from Peter Presnell - thanks!

using event object


In the event handler, you can use the following:

this.getParent().getValue() returns the value of the event's component.
this.getParent() returns the event's component.
this returns the event handler object.

using the event object in client side javascript


In client side javascript, there is an object named "thisEvent" in any event handler (for example in an onlick event).
So you can call a function like this:

myEventFunction(thisEvent)


function myEventFunction(e) {
  alert("raised event: "+event);
}


Event objects may be different among browsers, use this to fix that:

var e = dojo.fixEvent(thisEvent);
// now do something with the new event object stored in 'e'


For example to do something on ENTER, write this in the onkeypress event of the input box:

e = dojo.fixEvent(thisEvent);
if (e.keyCode == dojo.keys.ENTER) doSomething();

Created by Rene on May 10, 2011 10:47:32 PM

I am trying to get the event object in my onKeyDown event to do phone number validating and it's not working:

event is not a reserved object.. help!


Created by Julian Buss on May 27, 2011 2:09:38 PM

I just found that the event object is not present in all browsers. You can use "thisEvent" instead.


Created by 7 on Jul 4, 2011 2:08:10 PM


Add Comment

Name:
Comments:
Use  searchlotus.com  for news in the Web related to Lotus Notes and Domino,
and to search those sites.
Check  youatnotes.com  for great Lotus Notes, Domino and XPages software.
Did this information help you?
Please honor our efforts and flattr this!