cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ComplianceGuy
Level: Powered On

Hidden fields with conditional "required" property not working properly

Dear all,

 

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!

5 REPLIES 5
Super User
Super User

Re: Hidden fields with conditional "required" property not working properly

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.



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
ComplianceGuy
Level: Powered On

Re: Hidden fields with conditional "required" property not working properly

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.

Community Support Team
Community Support Team

Re: Hidden fields with conditional "required" property not working properly

Hi @ComplianceGuy ,

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:9.JPG

 

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ComplianceGuy
Level: Powered On

Re: Hidden fields with conditional "required" property not working properly

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:

required: If(And(Or(var3Ptype="Customer",var3Ptype="Both"),DataCardValue60.Value=true),true,false)

visible: If(And(Or(var3Ptype="Customer",var3Ptype="Both"),DataCardValue60.Value=true),true,false)

 

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).

 

// Edit:

 

Just to confirm: All SharePoint columns are not required.

Highlighted
Community Support Team
Community Support Team

Re: Hidden fields with conditional "required" property not working properly

Hi @ComplianceGuy ,

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:

If(
(var3Ptype="Customer" || var3Ptype="Both") && DataCardValue60.Value = true,
true,
false
)

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.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,663)