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.

View solution in original post

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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