cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
myonlywan
Helper I
Helper I

Grayed out field based on control?

Is it possible to grayed out a field based on checked box instead of using the visible option?
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @myonlywan,

 

Please take a try to set the Default property of the Checkbox control (Checkbox1) to following formula:

If(EditForm1.Mode=FormMode.New,false,true)

Note: The EditForm1 represents the Edit form control within your app.

 

Set the DisplayMode property of the field (that you want to gray out) to following formula:

If(Checkbox1.Value=true,DisplayMode.Edit,DisplayMode.Disabled)

 

Best regards,

Kris

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.

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi myonlywan

 

You can use the control 'DisplayMode' instead of 'Visible':

 

I suggest something like:

1. OnVisible property of screen:

UpdateContext({ChangeDisplayMode: DisplayMode.Edit})

2. Set DisplayMode property of your field to: 

ChangeDisplayMode

3. OnSelect property of your checkbox is:

UpdateContext({ChangeDisplayMode: DisplayMode.Disabled})

Let me know if that resolves your query.

It works! Thanks so much Smiley Very Happy

oh, i encounter an problem, when i unchecked, the comment box is disable.

but when i checked it again, the comment box is still disable.

Any idea

Hi @myonlywan,

 

Could you please share a bit more about your app's configuration?

 

I have made a test on my side, please take a try with the following workaround:

 

Set the DisplayMode property of the field (that you want to gray out) to following formula:

If(Checkbox1.Value=true,DisplayMode.Disabled,DisplayMode.Edit)

Note: The Checkbox1 represents the Checkbox control within your app.

 

The GIF image as below:Test1.gif

 

 

 

Best regards,

Kris

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.

@v-xida-msft

Thanks, it seem working now,..

 

in my case, if a user wanted to give comments, he will check the box "Comments"

and the comment text box will be editable. 

 

 

What would i need to change if i need the checkbox to be unchecked when a new form is created.

 

I tried checkbox default to false.but it doesnt work.What else must i change?Thanks so much

Hi @myonlywan,

 

Please take a try to set the Default property of the Checkbox control (Checkbox1) to following formula:

If(EditForm1.Mode=FormMode.New,false,true)

Note: The EditForm1 represents the Edit form control within your app.

 

Set the DisplayMode property of the field (that you want to gray out) to following formula:

If(Checkbox1.Value=true,DisplayMode.Edit,DisplayMode.Disabled)

 

Best regards,

Kris

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.

Thanks so much, It work perfectly. Powerapps is really powerful with these formula...got lots to learn Smiley Tongue

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (3,104)