Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

Bound Text Label & Auto Wrap Text

Posted on by 317
Hi Community,
 
1) I have a box with a drop-down list that returns different texts. How can I make a text input box display a value depending on the text selected in the drop-down list box?.
 
2) The box with the drop-down list has texts of different lengths. Can it be made so that depending on the size of the text, it changes size and automatically adjusts so that it appears completely in the box?.
 
 
Thanks¡¡
 
Francisco
Categories:
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 1,216 on at
    Bound Text Label & Auto Wrap Text
     
    try the following:
    Use the Switch function (or equivalent) to dynamically change the text input box value based on the drop-down selection.
    Switch(
        DropDown1.Selected.Value,
        "Option1", "Text for Option 1",
        "Option2", "Text for Option 2",
        "Option3", "Text for Option 3",
        "Default Text"
    )
     
    Auto-resize the drop-down list box using the TextWidth function in Power Apps or CSS/JavaScript in a web app for dynamic text length adjustment.
    TextWidth(DropDown1.SelectedText.Value, TextSize) + 20
     
    let me know if you still have issues.
     
  • Suggested answer
    Mark Nanneman Profile Picture
    Mark Nanneman 329 on at
    Bound Text Label & Auto Wrap Text
    Yes you can do these things.

    Just set the default value of the text field to the selected value of the dropdown or combobox.
     


    If you want to perform calculations on the fontsize, you can use the Len() function perhaps--but it might not be worth the trouble.  It might make more sense to just format your text input control as multiline and make it big enough to accommodate your longest string selection.



    Here I set the height of the text input to be based on formula around the length of the text value in the same control. 
     
    Min(Max(Len(Self.Value),30),100)

    If the length of the text is under 30, it goes with 30.  If the length of the text is over 100, it goes with 100.
     
    Under 30

     
    Over 30



    Over 100

    If this helped you, please click "Does this answer your question" and give it a like to help others in the community (+ close the ticket)!

    Power Platform Developer | LinkedIn: Mark Nanneman | Blog: Power Stuff  | YouTube: Mark's Power Stuff  | Buy me a coffee



     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,297

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,890

Leaderboard