cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper V
Helper V

Validate or show a message in label, if field is empty

I have a dialogbox in Powerapp, where approver has to key-in the reason for not approving the request. This field is a multiple lines of text and not mandatory in SharePoint, because only if the request is not approved, the below dialog appears and reason has to be keyed-in.

 

Since its not a mandatory field, I have written below validation in Proceed OnSelect to check if its empty or not. Still, I am able to submit the record and there's no notification message as stated in the code below

 

If(IsEmpty(DialogComments.Text),Notify("Please enter the reason",NotificationType.Error),SubmitForm(NewForm_2));

 

Scr.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User II
Dual Super User II

Hi @Kumar9024021 

 

IsEmpty function is used to check if a list is empty. If you want to check if a text input is empty, you need to use the IsBlank() function.

Can you try to update your expression to:

If(IsBlank(DialogComments.Text),Notify("Please enter the reason",NotificationType.Error),SubmitForm(NewForm_2));

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Super User
Super User

The key is to make the button disabled until the comments have been added since PowerApps does not have the nice feature to make something required.   You can also add an icon for the asterik and color it red, and make it visible/not visible based on your validation.

 

Use the 'Visible' attribute to control the visibility of the asterisk icon and your button.   

 

This is the visible statement for the asterisk icon.  If(IsBlank(tiCity), true)

 

This is the visible statement for my 'Next' icon.  If(IsBlank(ddEmployeeStatus) Or ddEmployeeStatus.Selected.ActualValue = "temp" And (IsBlank(dpStartDate) Or IsBlank(dpEndDate)), false, true)

 

 

requiredfield.png                 requiredfield1.png

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.
Dual Super User II
Dual Super User II

Hi @Kumar9024021 

 

IsEmpty function is used to check if a list is empty. If you want to check if a text input is empty, you need to use the IsBlank() function.

Can you try to update your expression to:

If(IsBlank(DialogComments.Text),Notify("Please enter the reason",NotificationType.Error),SubmitForm(NewForm_2));

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (31,331)