cancel
Showing results for 
Search instead for 
Did you mean: 

HCM F&P - How to set the field as Required based on drop down values

Former Member
0 Kudos

Hi Experts,

I have a requirement to set the Date field as mandatory when a particular value is selected in drop down list. I have already tried with MessageBox though it displays the error message but process moves further i.e. on clicking Check & Send button it throws an error message but still it moves further and i can see only Send button. Ideally it should halt there itself.

Thanks & Regards,

Jitesh Talreja

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

Let's assume you have DropDownList1 and DateTimeField1 fields in your form and if value is EN you want date to be mandatory

Use the following JavaScript in the exit event of the drop-down.

if(this.rawValue == "EN")
{
   DateTimeField1.mandatory = "error";
}
else
{
   DateTimeField1.mandatory = "";
}

Chintan

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your valuable inputs

Chintan

I have already tried this. It only highlight the field with the red border but still allow to move further.

Mukesh

Yes, we can definately control this from the backend but that would be the last option i should execute. Ideally, this is something to be controlled in front end itself

Poornima

By setting the field attrbiute Required will set the field mandatory as a whole irrespective of drop down values or any other UI element.

Regards,

Jitesh Talreja

chintan_virani
Active Contributor
0 Kudos

Oops I forgot in HCM P&F there is submit button in form else the code I gave you would have worked.

My guess is since Adobe form is just used to display/edit data in HCM P&F and the "submit" event is controlled from outside the form, mandatory check would need to done in the backend in some BADI or service class as Mukesh mentioned.

Chintan

chintan_virani
Active Contributor
0 Kudos

Refer Chris's blog mentioned below on how to solve your issue.

[HCM Processes & Forms: Required fields aren't what they use to be!|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/13816] [original link is broken] [original link is broken] [original link is broken];

Chintan

Former Member
0 Kudos

Already read this before but was thinking there must be some way to control this from front end itself. I am wondering that we need to create Generic Service for such a simple requirement.

Thanks all!!

Jitesh Talreja

Former Member
0 Kudos

Hello Jitesh,

Go to Tcode - HRASR_DT

Select the Process scenario

In the Process Scenario - go to Form Scenarios - Drill down to the Fields - Select the Date field - make it as a Required Entry in the Field Attributes.

Hope this helps.

Regards,

Poornima

Former Member
0 Kudos

Hi,

Make the mandatory check in side the Service class.

Kind Regards

Mukesh.