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

Setting Text Input in form on select of another object

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Setting Text Input in form on select of another object

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.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Setting Text Input in form on select of another object

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.

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training

View solution in original post

zblankenship
Level: Powered On

Re: Setting Text Input in form on select of another object

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.

Microsoft RusselThomas
Microsoft

Re: Setting Text Input in form on select of another object

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

 

 

 

 

 

Highlighted
Microsoft RusselThomas
Microsoft

Re: Setting Text Input in form on select of another object

@jdavis6615 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

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

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

Top Solution Authors
Top Kudoed Authors
Users online (5,315)