I am pretty new to PowerApps and this forum. If this was already addressed somehwere: my bad, feel free to point me in the right direction.
Currently, I am working on a multipage PowerApp form, based on a SharePoint list. In the form, the user can provide input with a series of toggles. A series of corresponding Text input fields depend on these toggles, in that their visible and required properties contain formulas referencing the toggles (using an if formula). So far so good.
In short: when a toggle's value is true, the text input field should be visible and required. If the toggle's value is false, the text input field should be invisible and not required.
When I test the form, the visible property responds correctly. However, upon submitting the form, the app treats the hidden text field as required anyway and shows an error message. When I uncheck the toggle a second time, the form responds as expected.
What I have tried sofar:
- The usual quality checks of the formulas.
- I double-checked that none of the SharePoint columns is required.
Would hugely appreciate your help with this issue. Many thanks in advance!
You could try setting the Required to the Visible property.
Example for the Title_DataCard1 Required Property: Title_DataCard1.Visible
The other thing you could test is to make hidden datacard visible and see if the asterisk is showing. This will tell you if the PowerApps form thinks it is required or if SharePoint is returning the required field error message.
Many thanks for your quick help.
I tried both avenues. Unfortunately, they did not solve the problem.
What is helpful to know: When I keep the fields visible, the issue does not occur (i.e. the required property responds as expected).
Now I am just wondering, whether PowerApps does not accept changes to properties of invisible items. (I am assuming here, that the invisible property is updated first, and then the required property is assessed, which would then be rejected because the card is already invisible). However, I would not know how to change the default order of changes to these properties.
Hi @Anonymous ,
How do you control the Visible of the Text Input Field in your Edit form? Could you please share more details about your formula?
How do you submit your form data? Using SubmitForm function?
Do you set the Filed data card as Required based on the Toggle control?
Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. Please consider take a try with the following workaround:
Set the Visible property of the Field Data card in Edit form to following:
If(Toggle1.Value = true, true, false)
Set the Required property of the Field Data card in Edit form to following:
If(Toggle1.Value = true, true, false)
Please check if you have referenced proper Toggle control within the Visible property and Required property of the Edit form.
In addition, please make sure all fields in your SP List data source itself are Not Required, if not, it would be conflict with above Visible Control formula. E.G. The Title field in your SP List should be set as Not Required, if not, even though, you control the Tilte field in your Edit form as Not Required, when you submit your form data, it would still show up the following formula:
Hi @v-xida-msft ,
Many thanks for your comments.
Allow me to provide a little more information:
The Toggle is part of 2_CustomerRegAuthorityRegistration_DataCard2; the control itself is called Datacardvalue60
The Free Text Field is part of 2_CustomerRegAuthorityComment_DataCard2; the control itself is called Datacardvalue61
Datacardvalue61 has the following formulas / properties:
var3Ptype is a global variable, that is set using Set(var3Ptype,DataCardValue16.Selected.Value) on a Formscreen that precedes the formscreen that contains the above mentioned toggle and free text field. I verified that it contains the correct value (namely either "Customer" or "Both" at the point where I test the toggle and text field.
The form data is submitted using a button with an onselect formula: SubmitForm(SharePointForm1_4).
Just to confirm: All SharePoint columns are not required.
Hi @Anonymous ,
Where do you put your Set() formula?
The var3Ptype variable would be populated with proper value only when the DataCardValue16 Dropdown box has selected a proper value, and the Set(...) formula has been fired.
Based on the formula you provided, I could not find any error syntax error with it. Please consider modify your formula as below:
Set the Required property of the 2_CustomerRegAuthorityComment_DataCard2 (Data card) to following:
(var3Ptype="Customer" || var3Ptype="Both") && DataCardValue60.Value = true,
Set the Visible property of the Datacardvalue61 (Free Text) to following:
If( (var3Ptype = "Customer" || var3Ptype = "Both") && DataCardValue60.Value = true, true, false )
Please take a try with above solution, then check if the issue is solved.
If the issue still exists, please consider re-generate a new app based on your data source, then try above formula again, check if the issue is fixed.
Keep up to date with current events and community announcements in the Power Apps community.
Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.
Check out the latest Community Blog from the community!