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

Cascading menus set to required but user can still submit if blank

Hi,

I have a cascading menu on my app - two fields (Division and Department).  They are both mandatory fields.  However, when a user selects a respective division from the dropdown and the corresponding departments are displayed, sometimes the user does not select an option and yet they can still submit the form.  I am not sure how to prevent this from happening.  Both fields are set to be required from within PowerApps and SharePoint, yet users can still submit.  Is there a way to have the system check this field to ensure it has a value in it, or disable the submit button or something if it does not.  Any guidance appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Try this one instead:

If(DateValue2.SelectedDate <= Today() && !IsBlank(Department_Dropdown_1.Selected),Edit,Disabled)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
BCLS776
Super User
Super User

Try putting the following in the DisplayMode property of your Submit button:

If(
    IsBlank(ddDepartment.Selected), // Insert the correct name for your dropdown here
    Disabled,
    Edit
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Hi @BCLS776 - thanks for the prompt feedback on this.  

This is the current formula on the DisplayMode property of the submit button:

 

If(DateValue2.SelectedDate <= Today(), DisplayMode.Edit, DisplayMode.Disabled) And If(IsBlank(Department_Dropdown_1.Selected),Disabled,Edit)

 

The first piece was always there and validates dates in the future.  I added the piece in bold based on your formula.  

 

I get this error:  Expected Enum value.  The property of this control expects Enum values.  The rule produces Boolean values which are incompatible.

Not sure how to resolve.

Try this version instead:

If(DateValue2.SelectedDate <= Today() && IsBlank(Department_Dropdown_1.Selected),Disabled,Edit)

This will keep the control disabled unless both DateValue2.SelectedDate <= Today() and IsBlank(Department_Dropdown_1.Selected) return true. Depending on your app's logic, you may want to switch !IsBlank for IsBlank

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

@BCLS776  - interesting concept.

It partially works now.  If Department is blank submit is disabled (great) and dates less than today need to be filled out as well.  Something strange happened though.  If I change the date to a date in the future, the submit button is enabled.   

If the date field alone is set to less than today and dept. is blank, submit is disabled.  When I populate dept. then submit is enabled.  However, if the date field has a future date, submit is also enabled.

Sounds like you want only dates that are today, or are in the past, so substitute this code:

If(DateValue2.SelectedDate > Today() && IsBlank(Department_Dropdown_1.Selected),Disabled,Edit)

The better practice though is to make sure the user cannot select a date in the future on your DatePicker

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

@BCLS776 - thanks again.  That is correct.  It still seems to be only satisfying one condition as in before, which is the date condition in the future.  It disables on this, but once I set the date to the past, even if the Department field is blank the submit button becomes enabled.  Submit generally would be disabled with the original formula I used, but its almost as if its not recognizing the department field or a value or non value in it.

Try this one instead:

If(DateValue2.SelectedDate <= Today() && !IsBlank(Department_Dropdown_1.Selected),Edit,Disabled)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

@BCLS776 - Perfect. 

Thank you so very very much for all your time and assistance with this.  Really appreciate it.  

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,707)