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

Lock a default value for a data card (choice field) in a form connected to Sharepoint list

I have a PowerApp with an edit form linked to SharePoint. I hardcoded a default value in one of the data cards. I want to lock this default value so the user of the powerapp cannot change it. I tried setting visble = false but that gave an error to users when they sumbitted the form.

 

Just in case it matters the datacard is a choice field and I had to do a work around to get the default value. I used the two formulas below on the screen and datacard. 

Screen:

OnStart = Set(var_default,"Template Update")

DataCard:

Default = {Value: var_default}

 

1 ACCEPTED SOLUTION

Accepted Solutions
TimRohr
Level 10

Re: Lock a default value for a data card (choice field) in a form connected to Sharepoint list

Have you tried setting the Display Mode property to DisplayMode.Disabled?

View solution in original post

3 REPLIES 3
TimRohr
Level 10

Re: Lock a default value for a data card (choice field) in a form connected to Sharepoint list

Have you tried setting the Display Mode property to DisplayMode.Disabled?

View solution in original post

Super User
Super User

Re: Lock a default value for a data card (choice field) in a form connected to Sharepoint list

There's an easy workaround for this - leave your choice field as normal once its working and getting the correct default, then create a blank label, put it on top of what you're trying to stop the user from touching. Then make sure to set whatever it is you're blocking them from (in this case choice field) to have an index of -1 so that they can't Tab into the field.

 

As an Added bonus, I like to set the borders and chevron and etc to blank RGBA(0,0,0,0) as well for field boxes so it just looks like it's being stated instead of them thinking they can change it:
image.png

I've attached the Proof of Concept app,

 

Cheers,

@iAm_ManCat




Don't forget to 'Mark as Solution' and 'Thumbs Up' those who deserve it!
Community Support Team
Community Support Team

Re: Lock a default value for a data card (choice field) in a form connected to Sharepoint list

Hi @kywest,

Could you please share a bit more about your scenario?

Do you not want the user to change the Default value within the Choice field or edit the Choice field itself within your Edit form?

If you don't want the user to change the Choice field itself within your Edit form, I agree with @TimRohr's thought almost. I think the DisplayMode property of the Combo Box could achieve your needs. Please take a try to set the DisplayMode property of the Combo Box control within the Choice field Data card to following:

DisplayMode.Disabled

If you don't want the users to change the Default value of the Combo Box within the Choice field Data card, you just need to share the end users with User permission rather than Co-Owner permission. The user who has User Permission to your app could only use your app, could not edit your app, so they could not change the Default value of the Combo Box control within the Choice field Data card.

 

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 358 members 4,331 guests
Please welcome our newest community members: