Thank you for taking the time to read my question.
Is it possible to select the value that already exists inside a label or a Text Input when it receives the focus?
On my Screen I have a drop down. When the user selects a value from the drop down I set the focus to my label. The Label's Text value is a Lookup, so I want to select the returned value when the label receives the focus.
Thanks!
Hi @iwonder
If you really want the ability to copy text from Power Apps, this might be useful for you:
Not sure how critical this functionality is for you, but may be worth an analysis to figure out if using a PCF control for this will be something that works for you.
Let me know if this helps.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
Hi, sorry for my slow reply. I was called into other tasks but am back now.
Yes I literally want to copy the value that is derived after the user makes selections from the dropdown boxes. We need to paste it into another system. This is a crude way of doing things I know but we have no other choice at the moment.
Thanks again
Do you want to literally copy the text or simply provide that as a starting point and allow users to override? Sorry if thats a dumb question. Just trying to understand the exact use case.
I have one other idea before I test it out. Add a label and then a text input control on top of it. Set the labels text to be based on the dropdown as discussed previously using Lookup(based on DropDown value selected by user))​;, then set the text input control's fill property to:
If(IsBlank(Self.Text), Transparent, White)
This was, when the focus is set on the text input control, they will see the text and can start typing in since the focus will be set on the text input control.
I will still try this out if this doesn't solve your use case since it sounds very interesting 🙂
---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
https://thepoweraddict.com
Thanks again for your reply.
Hint Text will not work. I want the users to be able to select the text.
If you're curious to try and figure it out, great! But don't spend too much time on it. My users can just select the value in the label and then copy it. I was just hoping to save them a step.
Awesome explanation, thank you for that!
One question I have is say when the label/text input control has the text "Test" written on it (from the example in the video), is there a possibility that the user doesn't update that value? Or the user will always have to type in something and update that Test to some other text?
If the user is always supposed to update that, you can achieve something similar by simply setting the text input control's Hint Text property in my suggested solution. Although when the focus is set to that text input control, the text would be blank.
I am not sure if we can achieve exactly what you want, but I will definitely try it out in some time and will get back to you.
---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
https://thepoweraddict.com
Hi,
Thank you both for the replies. I've been reading and re-reading them....
I can do what the gif shows already... I think, unless I'm missing something.
You know when you're filling in a form on a web site and there are pre-populated values in some fields? Then when you click on a field, the pre-populated value is selected so that if you start typing the pre-existing value is overwritten?
I want to select the value in the label or textinput when the label or textinput receives the focus.
This is a form I found on the internet. The form flow is backwards but it shows what I mean. The focus moves from the yellow drop down to the Text: field. When I do a Shift+Alt+Tab the focus move up to the Text: field and the value that is existing in the text box is selected.
Therefore, in my app I want to select a value from my dropdown. Once I do that, the lookup sets the value of my label and then the focus is set to the label. When the label receives the focus I would like the value to be selected just like "Test" is selected in the gif above.
Am I doing any better explaining? I hope so. Thank you for your patience.
If you liked my replies, please give kudos (Thumbs Up). And if any of them solved your problem, please mark that reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
You can make it slightly easier. Here is another set of things that you can do to make this work:
The reason for using Text Input control or a Button is because the focus will set on these controls and will be visible rather than on a label. Here is a quick demo:
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
hi there, better now i understand thank you. im with @PowerAddict on this one. remember the input vs label.
You can achieve this with 2 functions:
This should work. I will test it real quick and let you know if it works. If you get to test it before I do, let me know.
---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions.
Thanks!
Hardit Bhatia
Microsoft Business Applications MVP
WarrenBelz
146,745
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,091
Most Valuable Professional