web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Setting Text Input in ...
Power Apps
Answered

Setting Text Input in form on select of another object

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a form that asks for the name of the user. I am using the Office 365 connector to based on what is typed into the text box in the form. The results of the search are then displayed in a Gallery under the search box to act as a kind of autocomplete. I want a user to be able to click the name they want in the gallery and for that to then be put into the text box they originally typed into that starts the search. I used the formula: 

Gallery2_1.Selected.DisplayName

on the text input box in the default field. This throws an error of "This rule creates a circular reference between properties, which is not allowed. A property cannot refernce itself or other properties affected by its value" I understand the problem I am having, but I cannot fix it. Any help is appreciated.

Categories:
I have the same question (0)
  • Verified answer
    Shanescows Profile Picture
    2,218 Most Valuable Professional on at

    You have to do this dance a little different. 

     

    Set the TextInput Default to VarName

     

    Have the OnSelect for the gallery UpdateContext({VarName: Gallery2_1.Selected.DisplayName})

     

    You may have to throw in a Reset(TextInput) but I don't exactly follow what you are doing. I don't know why you want to change the box that they entered data into.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Awesome thank you that worked perfectly. I am working on the Service Desk template and for the requestor of the ticket I wanted to have an autocomplete list as the technician created the ticket. This works great thanks for your help.

  • RusselThomas Profile Picture
    4,014 on at

    I do this quite often - it's a little tedious, but I like the results it gives me.


    I use a TextInput and set the default value to varSelectedUser and the reset value to varResetInput

    [TextInput1]

    Default:

    varSelectedUser

     

    Reset:

    varResetInput

     

    I then use a ListBox which I position under the input and I set a couple of values;

    [ListBox1]

    OnSelect:

    Update the varSelectedUser value to what was selected

    Reset the InputText control to put varSelectedUser in there (toggle varResetInput true to false)

    UpdateContext({varSelectedUser: ListBox1.Selected.DisplayName});
    UpdateContext({varResetInput: true});
    UpdateContext({varResetInput: false})

    Items:

    If the textbox has more than 3 characters in it, search Office365Users by what's typed into the textbox and limit the results by 10.

     

    If(Len(TextInput1.Text)>3, Office365Users.SearchUser({searchTerm:TextInput1.Text, top:10}))

    Set the Fields value under the Items input to "Display Name" or whatever user info you want to appear in the list box as a result of the search.

     

     

    Visible:
    FALSE if TextInput has less than 4 characters in it 

    FALSE if the name typed in equals varSelectedUser

    FALSE if the value selected in the ListBox is equal to varSelectedUser

    otherwise TRUE

     

    If(Len(TextInput1.Text)<4, false, 
            If(TextInput1.Text = ListBox1.Selected.DisplayName, false,
                If(TextInput1.Text=varSelectedUser, false, true)))

    I'm sure someone can find a more elegant way of crafting this IF statement, perhaps even using Switch or the builtin Switch for IF - but I prefer stating each IF for readability 🙂

     

    I *think* that's about it 

     

    Hope this helps,

     

    RT

     

     

     

     

     

  • RusselThomas Profile Picture
    4,014 on at

    @Anonymous sent me a message on this and I promised to share back to the post.

     

    This is a bit old now, and not really rigorously tested, but perhaps still useful to some people - I decided to create a people picker component when components were initially released to test out the functionality...I still use it now and again, although I now prefer using Galleries over List Boxes these days 🙂

     

    Feel free to tear apart and make it your own

     

    Hope this helps someone

     

    Kind regards,

     

    RT

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 324 Most Valuable Professional

#2
11manish Profile Picture

11manish 193

#3
Valantis Profile Picture

Valantis 138

Last 30 days Overall leaderboard