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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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