cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
samleonard
Level: Powered On

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
jdelacrettaz
Level: Powered On

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)
Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





samleonard
Level: Powered On

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

 

Super User
Super User

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





Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!





Community Support Team
Community Support Team

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.
samleonard
Level: Powered On

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.

djoeg01
Level: Powered On

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
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,684)