Handling Enter Key in Web Applications

LANSA

Handling Enter Key in Web Applications
Example 187 - Rating: common
The Things that Make Up This ExampleTo Execute this Example

If a user of a LANSA for the Web application encounters a form with an input capable field on it, positions the cursor on that field, and presses Enter, the browser will hang. This example demonstrates the problem and two methods for avoiding the problem.

One method is to add a JavaScript function called HandleEnterKey to the default script for the process (process_SCRIPT) or for the entire application (DEFAULT_SCRIPT). Then, after every compile of every function affected by this problem, the HTML for the function is edited, and the FORM tag is altered to include:

onSubmit="return HandleENTERKey()"

The other method is to edit DEFAULT_HIDDEN or the process_HIDDEN and change two lines. The result of this change is that when the user presses Enter they will automatically be sent to the function they are in. This method does not require any editing of function HTML, but does require that all developers are aware of, and code for, what will happen when the user presses Enter.





Notes and suggestions

The IF statement in the JavaScript function HandleEnterKey is sensitive to the number of blanks in the string.



Keywords
Enter KeyExample 187
HandleEnterKey