Screen Validation

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();
}	
This entry was posted in Uncategorized and tagged , , , , , . Bookmark the permalink.

3 Responses to Screen Validation

  1. Pingback: Java Script Validation in Workflow | Vizual HR.Net Development: Tips, Tricks and Work-Arounds

  2. debbie coates says:

    Hello

    I just wondered if I can ask you this question. I’ve just started work for a company that uses HR.net, as the HR Systems Developer. I am an analyst developer, normally i work with vb6/SQL, so I am more than familiar with SQL. Obviously, I know from the name that HR.net was written in .net (not hard to establish that). The question i have is that when saving a screen, validtion is done at form level, ie save and close, then validation is applied. is there any way to apply field level validation, ie, if i leave a time field after inputting a time of 09.00, can i not apply field validation so that i will get an error message saying “Please apply time in correct format, ie HHMM”, and remove whats in the firld and set focus back onto that field (Does that make any sense to you). I’ve done this in VB when designing applications. I mentioned this to my boss, apparently she has asked vizual/adp about this and they say it cant be done. Any comments, ideas

    Many Thanks

    Debbie

    • admin says:

      Debbie,

      I remember I have implemented exactly what you are looking for via JavaScript (custom script). You’ll have to hook in to the form validation, like the post above talks, but then use .value() (from jQuery ) to remove anything from the field and then .focus() to change the focus. You can also do that on the input – same logic applies, but a lot more jQuery is required.

      Hope this helps

      Regards,
      Max

Leave a Reply to debbie coates Cancel reply

Your email address will not be published. Required fields are marked *