cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
geneZebra
Resolver II
Resolver II

Looking for a better way to validate a form. sharing but looking for a better way

I've been lookng for a way to use the error message in a form to show text if a value is not unique. I was able to report the error during entry by reading the data card's text value but when I submit the form, the error message appears for a brief period of time.

 

This is what  I set the error text lable to in the data card

 

ErrLabel.Text = Parent.Error & If (LookUp(_coTrips,DataCardTripName.Text exactin Title).ID <> ThisItem.ID && !Button_SubmitChanges.DisplayMode <> Disabled, "Trip name is not unique")

 

Note I try to use the disabled check to avoid getting error while the submit is in porgress. That did not work since the disabled property does not change during the submit even though it does in the UI. This should be seen as a bug but that's just me.

 

I also tried 
Parent.Error & If (LookUp(_coTrips,DataCardTripName.Text exactin Title).ID <> ThisItem.ID && Button_SubmitChanges.Color = Button_SubmitChanges.DisabledColor , "Trip name is not unique")

 

And that too shows up during the submit.
I eventually got this to work by using the following but I now I have to put in a needless variable to set and clear within the Button's OnSelect function.

Parent.Error & If (LookUp(_coTrips,DataCardTripName.Text exactin Title).ID <> ThisItem.ID && !_bSubmitInProgess , "Trip name is not unique")

 

If anyone does have a better techninque please share. Otherwise, I help this post helps.

Also on a side note, if anyone knows of an easy way to see if any of the data cards in a form have their errr label set, please share. I am thinking something like setting the valid value in the data card but don't see a way to do this yet. 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Acually, I tried it both ways and it seems I need to do the check on the error label it self not the data card. The data card's error value is not being set. I guess it does not evaluate until inside the submit.

 

Btn.DisplayMode: If(IsBlank(ErrorMsgTitle), Edit, Disabled) // this works
//If(IsBlank(EditFormUserTrip.Error), Edit, Disabled) //?? this does not work

 

Not title is from a SP list that needs this value to be unique otherwise the submit fails. I put that check in the error label and then check for empty in the DisplayMode property.

 

Thanks

View solution in original post

4 REPLIES 4
mdevaney
Super User III
Super User III


Also on a side note, if anyone knows of an easy way to see if any of the data cards in a form have their errr label set, please share. I am thinking something like setting the valid value in the data card but don't see a way to do this yet. 

 


 

You can check to see if a DataCard is in an error state by using the following code.  

 

Not(IsBlank(YourFieldName_DataCard.Error))

 

To check all the DataCards in a form simply reference the form instead.

 

And(
	Not(IsBlank(Form1.Error))
)

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Thanks, I will use that to se the enabled property of the submit button. Too bad, there is no way to do get a list of all the data cards automatically but this can work.

 

Thanks.

@geneZebra 

I made change to my previous post.  Go take a looksee.

Acually, I tried it both ways and it seems I need to do the check on the error label it self not the data card. The data card's error value is not being set. I guess it does not evaluate until inside the submit.

 

Btn.DisplayMode: If(IsBlank(ErrorMsgTitle), Edit, Disabled) // this works
//If(IsBlank(EditFormUserTrip.Error), Edit, Disabled) //?? this does not work

 

Not title is from a SP list that needs this value to be unique otherwise the submit fails. I put that check in the error label and then check for empty in the DisplayMode property.

 

Thanks

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,325)