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.
Solved! Go to Solution.
Try this one instead:
If(DateValue2.SelectedDate <= Today() && !IsBlank(Department_Dropdown_1.Selected),Edit,Disabled)
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
)
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
@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
@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)
@BCLS776 - Perfect.
Thank you so very very much for all your time and assistance with this. Really appreciate it.
User | Count |
---|---|
121 | |
87 | |
87 | |
75 | |
66 |
User | Count |
---|---|
215 | |
180 | |
138 | |
96 | |
82 |