cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to change a text value to a drop down value only OnChange

I have a text value called tTypeText. This shows a default value.

 

I have a drop down box called ddtype. If i select an item from the drop down box, i want it to change the value in the text box.

 

Anyone any ideas?

 

Many thanks

7 REPLIES 7
Highlighted
Advocate I
Advocate I

Re: How to change a text value to a drop down value only OnChange

This formula what you do is pass what you have in the drop down list to a texbox. 

You have to do this formula inside the tTypeText in the text part. I hope it works for you. 

If(Dropdown1.Selected.Value = 1; "1"; Dropdown1.Selected.Value)
Highlighted
Memorable Member
Memorable Member

Re: How to change a text value to a drop down value only OnChange

Hey @samleonard

 

 

This should work in the Text property of your tTypeText to show the selected value from the dropdown.

But could you be more specific about the value that should change when something is selected.

 

ddtype.Selected.Value

Kind regards

 

 

Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Highlighted
Frequent Visitor

Re: How to change a text value to a drop down value only OnChange

thanks for your replies.

 

Its the OnChange function i am struggling with. I dont always want the text box to take the drop down box's value unless a value is selected from it. Otherwise i want it to keep the default value.

 

thanks

 

Highlighted
Memorable Member
Memorable Member

Re: How to change a text value to a drop down value only OnChange

Hey @samleonard

 

 

By my knowledge I don't think it is possible to manipulate/change a text in an OnChange property of another field.

I tested it and  it doesn't change my text when I select a value from a dropdown. So this is what I did that didn't work in the OnChange of the dropdown:

If(!IsBlank(ddtype),tTypeText.Text = ddtype.Selected.Value, tTypeText.Text = "Text")

And can I know what the default value is from the textbox? It's easier to recreate your issue.

 

I'll try and dig deeper or find a workaround for this.

 

Kind regards

 

 

Tom



If this reply has answered your question or solved your issue, please mark this question as answered.

Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

Highlighted
Community Support
Community Support

Re: How to change a text value to a drop down value only OnChange

Hi @samleonard,

 

Would you please explain a bit for the text value here, a Textbox, or a TextInput?

For TextBox,  there is only Text property, and no default property that could work with,

for TextInput, it contains the Default property, which is the propery we could work with. For TextInput.Text, it refers to the actual Text value, there is no way to pre-define it.

For TextBox, if you would like to keep the Default value when Dropdown is not changed, we could take use of the following way to verify it:

Under TextBox text property, change the formula in the following way:

 

If(Dropdown1.Selected.Value="1","TextBox Default Value",Dropdown1.Selected.Value)

The first condition is used to check the Dropdown selected value with its (the dropdown) default value, here I use the dropdown sample and the default value is "1", if the selected value of the dropdown equals to "1", then the TextBox would show the Text Default Value, otherwise, it will show the Dropdown selected value.

 

 

There is a limitation for this, if the user changes the dropdown value back to default, then this formula won't show the proper dropdown value, but with the "TextBox Defualt Value".

Workaround here is:

Under the Dropdown list, add another entry to mark the unselect status, and change its defualt value with this, so that when user changes its value, this option won't be selected.

 

Another way is the following:

Under the Dropdown Onchange Property, copy and paste the following:

 

UpdateContext({Value1: Dropdown1.Selected.Value})

Once the dropdown changes its value, the Variable "Value1" would update its value with Dropdown selected value.

 

Then, use the Value1 in the Text Property of the Textbox, this way should make it work as expected:

67.PNG

 

Hope the information above is helpful.

Regards,

Michael

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Frequent Visitor

Re: How to change a text value to a drop down value only OnChange

Hi All,

 

The textbox is linked directly to the database. So whatever is stored in this field, it will post to SQL.

 

So the texbox shows its default value on load, and if a user then selects a new item from the drop down, i want this value to be posted to the textbox instead.

 

Hope this makes sense.

Highlighted
Advocate III
Advocate III

Re: How to change a text value to a drop down value only OnChange

Hi samleonard

 

Did you ever find the answer to this. I have the exact same requirement.  textbox gets value from table onload and then want to use a dropdown selection to change that as needed ?

 

thanks

Greg

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,831)