Thursday, May 21, 2009

UI Table Validations



Basically this is explaining how to do validations on tables.

Last week I had to do number validation on a emxTable edit to allow user only to key in values between 1-999. Initially thought of handling it with the attribute range but it becomes a huge drop down to choose from, that is when I opted for custom JavaScript validation on edit table (this valid for forms)

Below is a quick summary of the implementation:

1. You can use a custom JavaScript method to validate any field when it is displayed in Edit mode and the Editable setting is true. The method name is configured for the field with the Validate=methodName in table setting. The method can refer to the control with the keyword “this”.
2. For example, for a field with the Validate=validatePortfoilioPriority setting, the system calls the validatePortfoilioPriority () JavaScript function (shown below).

The function must return true for successful validation.


// JavaScript
function validatePortfoilioPriority() {
if(condition) {
} else (condition) {
}
return true;
}


3. Add this function to any JavaScript file or any JSP file. Make sure the name of the file is specified in emxSystem.properties file with the key SUITEKEY.UIForm.ValidationFile. You can assign one or more
files (separated by a comma) as the property value.

eServiceSuiteProgramCentral.UIForm.ValidationFile = scripts/bcValidation.jsp
You can assign one or more files separated by a comma as the property value
Please refer to Enovia Matrixone Application Development Guide for more detailed information.



Note: For reference just sees the “bcProjectDashboardEditTable” table in clear case (spinner/programcentral/business) and the method what I wrote is put in “bcUIFormValidation.jsp” in programcentral. And search for the fallowing line

“eServiceSuiteProgramCentral.UIForm.ValidationFile = emxProgramCentralUIFormValidation.jsp,bcUIFormValidation.jsp” in emxSystem properties file. This is the way we have to give the name of the file in emxSystem Properties file.


1 comment: