cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Chris_FSA
Level: Powered On

Validate Fields Using Rules On Multiple Page Form Using Patch

I've read various other threads on here on the subject of validating fields on multiple page forms and I'm currently attempting to use the rules method where the condition checks if the fields are blank and the action sets the display mode of the continue button to disabled if they are. However, I can't seem to get it to quite work.

 

One problem I've encountered is if there are multiple required fields, I can seemingly add the conditions with a double ampersand as 

"IsBlank(DataCardValue1.Text) && IsBlank(DataCardValue2.Text)" etc. However, I've found that if even one of the fields contain data, it seems to validate the rule and make the button active. Should these be created as separate rules? I've attempted that approach and the code for the DisplayMode seems to get bloated this way (and still doesn't work as expected).

 

I'm also having trouble getting the rule to validate if dropdowns contain a value. From reading other threads and documentation, I think I should be using one of the following:

  • "DataCardValue1.Selected.Value = Blank()"
  • "IsEmpty(DataCardValue1.Selected.Value)"
  • "IsEmpty(DataCardValue1.SelectedItems.Unit)"

However, these trigger various error messages, for example:

 

  • "Expected an operand. The formula or expression expects a valid operand. For example, you can add the operand '2' to the expression '1 + _' so that the result is '3'. Or, you can add the operand "there" to the expression '"Hi" & _' so that the result is 'Hi there'."
  • "Invalid argument type. Expecting one of the following: Boolean, Number, Text"
  • "Name isn't valid. This identifier isn't recognised."
  • "The funtion 'IsEmpty' has some invalid arguments."

So I'm guessing there's something missing from my clauses but some of those errors don't seem relevant to what I'm trying to achieve.

I initially wrote this as a reply to one of the older threads but thought I might get more traction if I posted it as a new question. Apologies if this approach is frowned upon.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Validate Fields Using Rules On Multiple Page Form Using Patch

@Chris_FSA 

First, no...always start a new post with new questions.  Even if it is a continuation of older threads that need more traction.  This way they appear recent and at the top of lists to be responded to.

 

So, for your first formula - The situation you are seeing is probably correct.  What you should consider is that each IsBlank is "and"ed together.  If any one of them is false, then the final result will be false.  You could either use the &&'s or consider using Or's ||'s  instead.

Look at some of this options:

IsBlank(DataCardValue1.Text) && IsBlank(DataCardValue2.Text) = Both must be blank to be true everything else is false

!IsBlank(DataCardValue1.Text) && !IsBlank(DataCardValue2.Text) = Both must NOT be blank to be true everything else is false

IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text) = If either is blank result will be true, if both have data, result will be false

!(IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text)) = If either is blank result will be false, if both have data, result will be true.

 

As for the dropdown/combobox selections - this is going to rely on how your data is populating those controls.  For example, if you use Distinct, then your items will be DataCardValue1.Selected.Result.  If you use basic items to populate, then it will be DataCardValue1.Selected.Value.  If you are using full records to populate, then it will have all the same columns as the datasource - so let's say there is a "Title" column in the datasource - DataCardValue1.Selected.Title

So, it's really dependent on your Items property for the control.  But in the end, you can use IsBlank(DataCardValue1.Selected.Value) (or whatever you determine "Value" should be instead) and it will give you the results you want.

 

I hope this is clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
2 REPLIES 2
Highlighted
Super User
Super User

Re: Validate Fields Using Rules On Multiple Page Form Using Patch

@Chris_FSA 

First, no...always start a new post with new questions.  Even if it is a continuation of older threads that need more traction.  This way they appear recent and at the top of lists to be responded to.

 

So, for your first formula - The situation you are seeing is probably correct.  What you should consider is that each IsBlank is "and"ed together.  If any one of them is false, then the final result will be false.  You could either use the &&'s or consider using Or's ||'s  instead.

Look at some of this options:

IsBlank(DataCardValue1.Text) && IsBlank(DataCardValue2.Text) = Both must be blank to be true everything else is false

!IsBlank(DataCardValue1.Text) && !IsBlank(DataCardValue2.Text) = Both must NOT be blank to be true everything else is false

IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text) = If either is blank result will be true, if both have data, result will be false

!(IsBlank(DataCardValue1.Text) || IsBlank(DataCardValue2.Text)) = If either is blank result will be false, if both have data, result will be true.

 

As for the dropdown/combobox selections - this is going to rely on how your data is populating those controls.  For example, if you use Distinct, then your items will be DataCardValue1.Selected.Result.  If you use basic items to populate, then it will be DataCardValue1.Selected.Value.  If you are using full records to populate, then it will have all the same columns as the datasource - so let's say there is a "Title" column in the datasource - DataCardValue1.Selected.Title

So, it's really dependent on your Items property for the control.  But in the end, you can use IsBlank(DataCardValue1.Selected.Value) (or whatever you determine "Value" should be instead) and it will give you the results you want.

 

I hope this is clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Validate Fields Using Rules On Multiple Page Form Using Patch

Hi @Chris_FSA 

 

Do you test with @RandyHayes 's suggestion?

Do you fix your issue?

If it works fine,please accept it as solution.

 

Best Regards.

Yumia

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

Follow PowerApps on Twitter

Stay Up-to-Date by following PowerApps on Twitter

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

Users Online
Currently online: 56 members 4,122 guests
Please welcome our newest community members: