cancel
Showing results for 
Search instead for 
Did you mean: 

HCM P&F Validation

Former Member
0 Kudos

Hai all,

I am using Form Calc to validate my hcm process and form. My requirement is i have to validate and throw a message by comparing two form fields. The field is ANSAL ( Annual salary). This field is to be compared with CPMAX (max range for pay grade salary ) and with CPMIN (min range for pay grade salary ). Currently i am just hard coding like this

if( $ > "999000" ) then

$host.messageBox("Annual Salary is large than 20000","This is a message",0,3)

elseif( $ < "100000" ) then

$host.messageBox("Annual Salary is less","This is a message",0,3)

elseif( $ > "100000" and $ < "990000" ) then

$host.messageBox("Annual Salary is within the range","This is a message",0,3)

endif

Here $ represents the current object ANSAL. I have placed this code in the VALIDATE event of ANSAL field.This is working but instead of that hard coded values i have to use CPMAX and CPMIN. I want to know how this field values can be referred.Both CPMAX and CPMIN are not displayed in form.IT is only for validating purpose.

Thanks

Ramesh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ramesh,

Good day.

Agree with Chris Solomon suggestion, you can always make use of generic service to do the validation for you by triggering round trip to back-end in "exit" or "change" event (for drop down list or input box) and "click" event (for button). This method is good if you want block user from proceed to submit the form until they've keyed in the correct value.

The only drawback of this method is, you need to handle this the flow properly because the form might trigger DO_OPERATION / INITIALIZE method(depends on what value you pass into ISR_EVENT before you trigger round trip to backend) in all generic services you have in the form .

You might need to use user event (although it is not working as expected) + some trick to overcome this. Let me know if you need further info on this.

By the way, I have a simple solution for you; if you want to pop out a message is to alert user only, and user still allow to submit the form.

1. Create a generic service to to retrieve value for CPMIN and CPMAX. Implement the coding in initialize method to generate value for CPMIN and CPMAX. Go to Form Scenario -> Form -> click on "Update and activate" button to generate the new field in ISR SCENARIO and adobe form interface.

2. In your adobe form, implement the "change" event of your ANSAL input box (sample code as below with LANGUAGE = FORMCALC)


var ANSAL = xfa.event.newText

if(  ANSAL > $record.CPMAX.DATA.FIELD ) then
$host.messageBox("Annual Salary is large than 20000","This is a message",0,3)
elseif( ANSAL < $record.CPMIN.DATA.FIELD ) then
$host.messageBox("Annual Salary is less","This is a message",0,3)
elseif( ANSAL >= $record.CPMIN.DATA.FIELD and ANSAL <= $record.CPMAX.DATA.FIELD ) then
$host.messageBox("Annual Salary is within the range","This is a message",0,3)
endif

Hope this helps.

Thanks,

Xiang Li

Edited by: xiangli heah on Sep 2, 2009 7:53 AM

Former Member
0 Kudos

Hi Xiangli,

I was trying with User Event in Adobe Forms ( HCM Forms) but its not working. So i am using Check Event. The problem with Check event is not only doing my operation it does the whole operation. You mentioned there is some tricks to run User Event. Can you please let me know how to do that.

Thank you.

VJ

ChrisSolomon
Active Contributor
0 Kudos

You won't ever fire the "validate" event directly with HCM P&F. You can "check" your values in the "exit" or "change" events but that is about it. For true validation, you will need to use a generic service. I wrote a blog about this recently....

/people/christopher.solomon/blog/2009/06/22/hcm-processes-forms-required-fields-arent-what-they-use-to-be