Intercept Submit Action

The validateButtonPressed event has a variable, pActionId, that will contain the ID of the button that was clicked.  If you return false then the submit action is cancelled.  You can use these tools in a variety of ways to build in extra form validation to make sure the form is not submitted with bad data (or the lack of necessary data).


Lets say you need to confirm the that user agrees with some legal terms or some other conditions before they submit a form.  You could do this a number of ways.  One simple way to do this is with a little bit of JavaScript on the validateButtonPressed Form event.  The experience provides the interaction needed for positive confirmation - much like you see when accepting a software license.


if(pActionId === 'S_Submit') { 
  if(confirm("BY CLICKING ON THE 'OK' BUTTON, YOU AGREE TO THE TERMS OF THIS  AGREEMENT. IF YOU ARE ACCEPTING THESE TERMS ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE FULL AUTHORITY TO BIND SUCH COMPANY OR OTHER LEGAL ENTITY TO THESE TERMS IN WHICH CASE THE TERMS WILL REFER TO SUCH ENTITY. THE AGREEMENT IS EFFECTIVE AS OF THE DATE YOU ACCEPT THESE TERMS ('Effective Date').\n\nIF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT AGREE TO THESE TERMS, DO NOT CLICK THE 'OK' BUTTON")) {
    return true;
  }
  return false;
}


Another example might be to not allow the form to be submitted if a table item did not contain the minimum number of rows:

if(pActionId === "S_Submit") {

  if(BO.F_Table.getLength() < 5) {
    alert("A minimum of 5 rows must be provided in the table before submitting the form. You currently have " + BO.F_Table.getLength() + ".");
    return false;
  }
}