cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lliu_western
Resolver II
Resolver II

A button that enable input box

Hello community,

 

I have a question. I have a button, and when a user select the button, I want it to enable the input text box next to it.

 

So by default, the input text box will be disable and can only be enable when button next to it is clicked.

 

I tried a function on the button: OnSelect: Q_TextInput.DisplayMode.Edit     

 

but it doesn't work. Any help is appreciated, thank you. 

3 ACCEPTED SOLUTIONS

Accepted Solutions
mdevaney
Super User
Super User

@lliu_western 

Use a toggle instead of a button.  Then put this code in the DisplayMode of the Text Input

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

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

DevendraSingh
Resolver I
Resolver I

Hi,

You can use variables for this. Following are the steps,

  • Step1: Add formula Set(buttonClicked, false) to "OnVisible" property of screen
  • Step2: Add formula If(buttonClicked, DisplayMode.Edit, DisplayMode.Disabled) to "DisplayMode" property of text box control
  • Step3: Add formula Set(buttonClicked, true) to "OnSelect" property of button control

Please click Accept as Solution, if this solution solved your issue. If this post was useful, please consider giving it Thumbs Up.


Thanks & Regards,

Devendra Singh

View solution in original post

lliu_western
Resolver II
Resolver II

I found another way.

 

First, I added a toggle just like the previous answer mentioned and set the input text display mode with the function: If(Toggle1.Value=true, DisplayMode.Edit, DisplayMode.Disabled)

 

Then with the button, I have a function of Onselect: Set(setToggle1,true)

 

And in the Toggle1 defult: setToggle1         (setting up the variable here) 

 

Have the Toggle1 visable to be false then it acts like the button is enabling the input text. 

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@lliu_western 

Use a toggle instead of a button.  Then put this code in the DisplayMode of the Text Input

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

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

For a button to work, you can use UpdateContext({enablebox:DisplayMode.Edit}) in its OnSelect property and in the TextInput box put its DisplayMode property as enablebox.  You would put UpdateContext({enablebox:DisplayMode.Disabled}) in the OnVisible property of the screen.  That would set the default display mode of the TextInput to disabled.

Given that I think @mdevaney 's idea is better.

DevendraSingh
Resolver I
Resolver I

Hi,

You can use variables for this. Following are the steps,

  • Step1: Add formula Set(buttonClicked, false) to "OnVisible" property of screen
  • Step2: Add formula If(buttonClicked, DisplayMode.Edit, DisplayMode.Disabled) to "DisplayMode" property of text box control
  • Step3: Add formula Set(buttonClicked, true) to "OnSelect" property of button control

Please click Accept as Solution, if this solution solved your issue. If this post was useful, please consider giving it Thumbs Up.


Thanks & Regards,

Devendra Singh

lliu_western
Resolver II
Resolver II

I found another way.

 

First, I added a toggle just like the previous answer mentioned and set the input text display mode with the function: If(Toggle1.Value=true, DisplayMode.Edit, DisplayMode.Disabled)

 

Then with the button, I have a function of Onselect: Set(setToggle1,true)

 

And in the Toggle1 defult: setToggle1         (setting up the variable here) 

 

Have the Toggle1 visable to be false then it acts like the button is enabling the input text. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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