Hello,
I have a NewForm connected to an excel file. There are checkboxes on the page which make certain datacards visible. When these datacards become visible upon selection of the checkbox I'd like them to be required fields. When they are hidden I would like them to be unrequired.
Alternatively, I'd like to make datacards required if a different data card has a value entered in it. for example, if there is a data card for Product Description and Product Code, I'd like to make the product code datacard required when there is a value entered in the product description datacard.
Both of these solutions are equally valid and any help is much appreciated!
Thanks!
Cooper
Solved! Go to Solution.
Hi @Cooper
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!
Hi @yashag2255
This was a great solution but I have two edits to make it more clear for future people who come across this post.
1. Set the "OnUncheck" property to Set(CheckboxChecked, false) .... previously you had the Oncheck and OnUncheck properties both set to "true" and this kept powerapps from understanding the boolean nature of this function.
2. set the visible property of the datacards to If(CheckboxChecked,true,false). Yes, this is the same formula that you will put in the required property for the datacards. By doing this instead of setting the visible property to "CheckboxChecked," by default the datacards will not appear until the checkbox is checked and when you check the box it will make the fields required. both the visibility and requirement of these datacards will toggle with the checkbox. When you set the visible property to just "CheckboxChecked," by default the datacards are visible when you first enter the page even though the checkbox is unchecked by default (you should not be able to see the cards until the box is checked). Then, upon the first check of the box they become required (you see a star appear next to the title) and upon first uncheck they disapear. After that, the functionality works fine. Using the If statement just makes it so that when you first enter the page with the datacards and checkboxes that the datacards are not visible until you check that box.
everything else in your response worked great. Thanks so much!!
For your first scenario, it sounds like you can set the "Visible" and "Required" properties of the datacard to the Value of the Checkbox.
To test this, I tried to recreate the issue with input box fields instead of connecting to an Excel spreadsheet, but it should work the same way.
For my test:
Checkbox1.ValueTextInput2 Visible property:
Checkbox2.Value
Hi @Cooper
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!
Hi @yashag2255
This was a great solution but I have two edits to make it more clear for future people who come across this post.
1. Set the "OnUncheck" property to Set(CheckboxChecked, false) .... previously you had the Oncheck and OnUncheck properties both set to "true" and this kept powerapps from understanding the boolean nature of this function.
2. set the visible property of the datacards to If(CheckboxChecked,true,false). Yes, this is the same formula that you will put in the required property for the datacards. By doing this instead of setting the visible property to "CheckboxChecked," by default the datacards will not appear until the checkbox is checked and when you check the box it will make the fields required. both the visibility and requirement of these datacards will toggle with the checkbox. When you set the visible property to just "CheckboxChecked," by default the datacards are visible when you first enter the page even though the checkbox is unchecked by default (you should not be able to see the cards until the box is checked). Then, upon the first check of the box they become required (you see a star appear next to the title) and upon first uncheck they disapear. After that, the functionality works fine. Using the If statement just makes it so that when you first enter the page with the datacards and checkboxes that the datacards are not visible until you check that box.
everything else in your response worked great. Thanks so much!!
User | Count |
---|---|
120 | |
87 | |
86 | |
75 | |
66 |
User | Count |
---|---|
214 | |
181 | |
139 | |
96 | |
83 |