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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,148)