cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JGregson
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
rebeccas
Community Champion
Community Champion

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!

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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,663)