Dropdown Search Validation |
Ver. 1.00 Contributed by Paresh Shah |
What
n_cst_dwsrv_dropdownsearch
Why
For the drop down search service to work, the columns need to be editable. This creates an undersiable effect of allowing the user to type in a value that may pass the data type validation but is not in the drop down list, thus destroying the referential integrity.
To avoid this problem, the service has been extended to provide a function to validate the user's entry against the drop down list.
How
Use the service functions below to provide the validation functionality in your applications.
of_ShowMessage - Controls wheter the validation service should display the error message. of_Validate - Validates the user entered value against the drop down list. If the value is not found, it will display an appropriate message. Validation only occurs for columns that registered as Search columns via the of_AddColumn() function.
of_ShowMessage
Access : Public Syntax : dwControl.inv_dropdownsearch.of_ShowMessage (avb_Show) Argument Description: dwControl Instance name of the u_dw based Datawindow Control avb_Show Boolean specifying the wheter the message should be displayed. Return Value: Integer Returns 1 for success Returns -1 if an error occurs Usage : To show the default message call this function prior to validation
Event::Constructor
dw_1.inv_dropdownsearch.of_ShowMessage( True )
of_Validate
Access : Public Syntax : dwControl.inv_dropdownsearch.of_Validate ({row}, {column}, {data}) Argument Description: dwControl Instance name of the u_dw based Datawindow Control row Long specifying the row to be validated column String specifying the column to be validated data String specifying the data to be validated Return Value: Integer Returns 1 for success Returns 0 if no match was found Returns -1 if an error occurs Usage : Call this function to perform validation
Event::ItemChanged
IF dw_1.inv_dropdownsearch.of_Validate (row, dwo.Name, data) <= 0 THEN Return 1 END IF
Event::pfc_Validation
/* validate all registered columns in a specific row */ ll_row = This.GetRow() IF This.inv_dropdownsearch.of_Validate (ll_row) <= 0 THEN Return -1 END IF /* validate a column (Dept ID) in a specific row */ ll_row = This.GetRow() ls_Column = 'dept_id' IF This.inv_dropdownsearch.of_Validate (ll_row, ls_column) <= 0 THEN Return -1 END IF /* validate all rows and all columns that have dddw search */ IF This.inv_dropdownsearch.of_Validate () <= 0 THEN Return -1 END IF
Download the | About the extension contributor |
Interested in contributing material to this web site? Send an email to submit@pfcguide.com, but don't forget to check the contribution guidelines first.
For information or suggestions about this web site please contact webmaster@pfcguide.com
PFCGuide is
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a
contract or a liability against Dynamic
Technology Group.