Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)


The submission is not caused by an event; it's default browser behaviour

Some browsers, by default, submit forms when the Enter key is pressed in a text field. According to one website I've checked, this occurs when there is only one text field on the form, and does not occur otherwise.

This submission can normally be stopped by having an onkeypress event return false. See the example on the bottom half of this page: http://jennifermadden.com/javascript/stringEnterKeyDetector.html
This works in a legacy Domino form, but does *not* work in XPages.

I did some experiments with this today, and I'm now fairly sure that the cause is the way the XPage auto-generated client JS attaches events to elements. If I use the XPage designer to write an event that returns false, it seems like the return value is caught somewhere in the XSP object, but is not passed back to the element that triggered the event. Therefore, the browser still treats the event as if it returned true, and the default submission still occurs.

I have managed to work around the problem by avoiding the XPage designer for the onkeypress event. Instead, I've written code in a client JS library to find the text field and attach my own event, which does not use the global XSP object at all. This works, but was more difficult to code.


Feedback response number WEBB7RLHZM created by ~George Umboosicheketsi on 04/30/2009

XPage onkeypress event handler - ho... (~Bella Zenfooma... 29.Apr.09)
. . SOLVED: use "thisEvent.preventDefau... (~Bella Zenfooma... 1.May.09)
. . Does 'No Data Validation' help? (~Joan Zektoomar... 29.Apr.09)
. . . . 'No data validation' makes no diffe... (~Bella Zenfooma... 30.Apr.09)
. . Pressing Enter on a Edit box should... (~Joan Zektoomar... 30.Apr.09)
. . . . The submission is not caused by an ... (~George Umboosi... 30.Apr.09)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS