12 8 Handle the ENTER key in Browsers

LANSA Web Functions

12.8 Handle the ENTER key in Browsers

LANSA for the Web uses the onsubmit JavaScript method to detect when the user has submitted the Form. The onsubmit JavaScript method calls a JavaScript Function HandleENTERKey to check if the PROCESS and FUNCTION Hidden Fields are Blank. If the fields are blank - an alert message is issued and the form is NOT submitted as the HandleENTERKey Function returns False. In WEBEVENT Functions, you can set the PROCESS and FUNCTION Hidden fields to merge in the current process using the <RDML MERGE="*PROCESS"> and the current Function using the <RDML MERGE="*FUNCTION"> tags if the WEBEVENT Function is calling the same Function to continue processing. The HandleENTERKey JavaScript as well as the FORM Tag with the onsubmit method is shown below:

<form name="LANSA" method="post" action="CGI-BIN/LANSAWEB?WEBEVENT+L0192D93983F9389E0293+WEB" onsubmit="return HandleENTERKey()">

 

function HandleENTERKey()

{

   if (document.LANSA._PROCESS.value == "         " || 
       document.LANSA._FUNCTION.value == "         ")

   {

      alert("Form cannot be submitted using the ENTER button. Click on a BUTTON to submit.");

      return true;

   }

   else

   {

      return false;

   }

}