Many times I need to validate entries on the screen via JavaScript (or Custom Script, in terms of HR.Net).
For about a year I struggled with validation via overloading function “Page_ClientValidate“. But when you overload this function, you can’t run original validation that HR.Net prepared for you, so if in the table you have regular expression validation, it is not executed. But when you try to save incorrect data (according to the regexp) this does not show any message and doesn’t save as well.. which is very frustrating to the user.
Today I’ve discovered new way of calling validation function with using original HR.Net procedure:
var org_Page_ClientValidate = window.Page_ClientValidate; window.Page_ClientValidate = function(){ var ErrMsg =''; var validate = true; // your custom validation goes here if (!validate){ alert(ErrMsg); return false } return org_Page_ClientValidate(); }
Pingback: Java Script Validation in Workflow | Vizual HR.Net Development: Tips, Tricks and Work-Arounds