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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (4,590)