Jack2019
Scholar

Nested validation within panel

Jump to solution

I need a validation: first step slection " System " panel in Category, 2nd step selection: if select Type  " New" or " Change", then " Date", "Name" ,  " Level" fields are required fields, but these fields are not required if "Remove" is selected. I applied validation rule below, but not working.

 

and(and(equals(Category, "System"), equals(Type, "New")),isNullOrEmpty({Self}))

 
 
0 Kudos
Reply
6 Replies
eharris04
Collaborator

Re: Nested validation within panel

Jump to solution

@Jack2019 may I suggest stepping through your validation swith one control at a time. This way you know that your validation is working and where its failing. I'm not sure why you have the double "and" there because it can be inclusive. You may have to build a single rule to cover one New and then another for Change.

 

Hope that helps.

0 Kudos
Reply
Jack2019
Scholar

Re: Nested validation within panel

Jump to solution

Thanks, eharris04. Just wondering, can I apply multiple validation rules on one control? 

0 Kudos
Reply
eharris04
Collaborator

Re: Nested validation within panel

Jump to solution

@Jack2019 yes you can apply more than one rule to a given control. You can also stitch rules if you understand how they work and thats what I was referring to when I said to start with one validation at build from there.

 

 

0 Kudos
Reply
Jack2019
Scholar

Re: Nested validation within panel

Jump to solution

I want two conditions met then required field : Category == "System" ( 1st selected as panel), Type == "New" ( 2nd selected within panel), if use two rules, it does not work ( only one condition one time)

0 Kudos
Reply
eharris04
Collaborator

Re: Nested validation within panel

Jump to solution

You don't need to run a rule on the panel unless you are applying something to the panel like showing/hiding it. 

 

Can you provide a screenshot of your form? I'm not sure why you would have two panels for the fields.

0 Kudos
Reply
kunalpatel
Collaborator

Re: Nested validation within panel

Jump to solution

When you said "Required", did you mean SharePoint column as Required? If so then you won't able to submit the item if they are hidden and does not have value.

 

If not then below solution should work fine:

 

You can hide panel # 2 if Category value is not System in Panel 1:

Rule to hide: {ItemProperty:Category} != "System" then HIDE.

 

Now add a calculated control (which can be hidden all the time, I use "1<2" rule to always hide any control) and name it as "ctrl_calc_DNL_Validation", make sure it re-calculates in all 3 views and put below formula:


If(or(ItemProperty:Type == "New",ItemProperty:Type == "Change"), If(isNullOrEmpty(ItemProperty:Date), true, false), false)

 

Now you need to create 2 rules for each "Date", "Name" & " Level":

 

For Date:

  1. Formatting Rule:
    • Condition: or(ItemProperty:Type != "New",ItemProperty:Type != "Change")
    • Formatting: Hide The Control
  2. Validation Rule:
    • Validation Rule - ctrl_calc_DNL_Validation != 'false'
    • Validation Msg - Please provide valid date.

If Date, Name & Level are in same panel then apply formatting rule on the panel and validation rule on each of them since message will be different for each control.

 

Let me know if this worked for you or not.

 

- K

 

View solution in original post

0 Kudos
Reply