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

Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi guys,

 

Currently in my InfoPath, I have a validation settings which shows an error textbox if the validation didn't pass.

 

Condition:

There are multiple numbers of conditions, and they all depend on the department name:

 

  1. My Department (look-up drop-down's value) = 1
  2. Manager Name NOT EQUAL to "Name 1" and
  3. Manager Name NOT EQUAL to "Name 2"
  4. Show error message "Wrong Manager chosen for the department"

 

  1. My Department (look-up drop-down's value) = 2
  2. Manager Name NOT EQUAL to "Name 3" and
  3. Manager Name NOT EQUAL to "Name 4"
  4. Show error message "Wrong Manager chosen for the department"

See the attached image for reference.

 

How can I do the same in PowerApps?

 

Thanks

 

Ifti

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @ifti ,

 

Do you want to there is one error message shows when the conditions as your formula expression describe?

I think you can try the following workaroud:

I test as next:

(I test instead  your departments' "1,2" with "D1" "D2",your Manager Name "1,2,3,4" with "M1,M2,M3,M4",you can change those on your side)

 

Add one Label in the screen and Label2.Text:"Wrong Manager chosen for the department"

 Label2.Visible:

If((DataCardValue2.Selected.Value = "D1" && (DataCardValue3.Selected.Value= "M3" || DataCardValue3.Selected.Value= "M4"))||(DataCardValue2.Selected.Value = "D2" && (DataCardValue3.Selected.Value= "M1" || DataCardValue3.Selected.Value= "M2")),true)

20190313validation1.PNG

 

Result Test:

20190313validation.gif

 

Hope this could be helpful.

 

Best Regards.

Yumia

 

7 REPLIES 7
Community Support Team
Community Support Team

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @ifti ,

 

Do you want to there is one error message shows when the conditions as your formula expression describe?

I think you can try the following workaroud:

I test as next:

(I test instead  your departments' "1,2" with "D1" "D2",your Manager Name "1,2,3,4" with "M1,M2,M3,M4",you can change those on your side)

 

Add one Label in the screen and Label2.Text:"Wrong Manager chosen for the department"

 Label2.Visible:

If((DataCardValue2.Selected.Value = "D1" && (DataCardValue3.Selected.Value= "M3" || DataCardValue3.Selected.Value= "M4"))||(DataCardValue2.Selected.Value = "D2" && (DataCardValue3.Selected.Value= "M1" || DataCardValue3.Selected.Value= "M2")),true)

20190313validation1.PNG

 

Result Test:

20190313validation.gif

 

Hope this could be helpful.

 

Best Regards.

Yumia

 

Super User
Super User

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

That is what I would do too....only thing I would add is to also make your submit button disabled if the error label is visible. 

ifti
Level: Powered On

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Thanks @v-yuxima-msft  and @rebeccas.

 

I'll test both of your code samples and will let you know, probably by end of the week or next week.

 

Appreciate you taking your time to look into my query.

 

Cheers,

Ifti

Community Support Team
Community Support Team

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @ifti ,

 

I am looking forward to your test result.

Hope it works well.

 

Best Regards.

Yumia

Community Support Team
Community Support Team

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @rebeccas ,

 

Thanks for your post.

 

Best Regards.

Yumia

ifti
Level: Powered On

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @v-yuxima-msft ,

 

Thank you so much for the help.

 

I had to replace = with <> because of my requirement.

 

Example: (DataCardValue3.Selected.Value= "M3" was changed to (DataCardValue3.Selected.Value<> "M3".

 

It's all working now and I've published it to the production. Wouldn't be possible without your help.

 

Thank you!!

 

Ifti

Highlighted
ifti
Level: Powered On

Re: Validation of specific text in a datacard before user can submit a form (just like InfoPath)

Hi @rebeccas ,

I added that too. Thank you for your suggestion.

 

Ifti

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

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: 231 members 5,315 guests
Please welcome our newest community members: