cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Make a field 'required' even if not 'visible' using custom card text fields

Hello,

I am working on a SharePoint Custom List and as such am limited with certain formatting options. 

 

I am trying to recreate a 'table'-like design for part of my form for 6 SP columns and could not find a way to do this using form columns from SharePoint. As a workaround I did the following:

 

1. I created a Custom Data Card and added 6 text fields in a table-like format with 3 rows and 2 columns. The Data Card is visible based on a DropDown elsewhere in the form. As there are multiple fields in this card I have left the 'Required' property as 'false'

 

2. I then added the 6  SP 'columns' to my form and set their default values equal to the text of one of each of the custom text fields mentioned above (only if the text field was filled, to prevent zeroes being pulled through). I then set the properties of these to 'required' if the Custom Data Card mentioned above is visible.

If (CustomDataCard.Visible=true,true,false)

 

This validated the form as expected, preventing submission if the Custom Text Fields were not completed and allowing submission if they were.

 

However I then set visible properties of the SP columns (mentioned in part 2.) to 'false' and the validation stopped working, allowing submission whether the custom fields were filled or not.

 

Any help appreciated, including correction if my approach to the table format is wrong.

 

Let me know if more information required

 

 

 

2 REPLIES 2
Highlighted
Super User
Super User

Re: Make a field 'required' even if not 'visible' using custom card text fields

I set those rules on my button. Typically what I do is set the star visible (for each field) if it is a required field...sometimes you will have more than one criteria for this like if combobox1.Selected.Value="blah" && IsBlank(DataCardValue) than visible true.

 

Then I put a message at the bottom or near my submit button that says something like "You have required fields missing" and I set its visible property to look at all my stars...so Visible=If(Star1.Visible=true || Star2.Visible=true, true, false)

 

And lastly I have my button show but set the DisplayMode of it to disabled if that message is showing so the DisplayMode would be =If(lbl_MissingMessage.Visible=true, DisplayMode.Disabled, Edit)

 

I like all of my rules in the app because it saves me on flipping back and forth. Let me know if you think that will help with what you need and I didn't explain it well enough and I will open an app of mine to get it exact. Hope this helps!

Highlighted
Frequent Visitor

Re: Make a field 'required' even if not 'visible' using custom card text fields

Thanks for the response @rebeccas 

 

Our form is so large that I'm not sure about using this method to account for all the fields although I will look at this as a possible solution.

 

In the first instance, I can't seem to locate the textrequiredstar in my custom datacard's controls/properties (I am assuming you are referring to what this info is talking about: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/working-with-cards)

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,407)