In this Power Apps Tutorial, we will see how to get value from text input in Power Apps.
Recently, we were asked by one of our clients to get value from text input. That means when the user inserts any data within the text input control and clicks on a button control, the item will be getting by a data source (Whether it is a collection or SharePoint list). Follow this tutorial, to get the solution.
Along with this, we will cover the below topics based on the Power Apps text input control. Such as:
- Get value from Power Apps text input using a filter function
- Get value from Power Apps text input using the search()
- Get password value from Power Apps text input
Also, Read: How to Get Gallery Item By ID in Power Apps
Get Value from Text input in Power Apps
In this section, we will see how to get the value from a single text input control to a data source.
Here, we are going to use a collection that will display the value that we got from the text input control. To work with these scenarios, the following steps are:
- On the Power Apps screen, we have created a collection ‘CollName’ on the screen visible property.
OnVisible = ClearCollect(
ColName,
{UserName: "Johney"},
{UserName: "Marly"}
)
Where ColName is the name of the collection and UserName is the name of the collection header.
- Add a gallery to the screen and connect it with the collection to show the collected data. For this, set the collection name (ColName) on the gallery’s Items property.
- Next, add a text input control to the above Power Apps screen and give a name to the text input control i.e., UserName_txtInput.
- Add a button control to the Power Apps screen and insert the below expression on the button’s OnSelect property.
OnSelect = Patch(
ColName,
Defaults(ColName),
{UserName: UserName_txtInput.Text}
);
Reset(UserName_txtInput)
As per the above expression, when the user clicks the button the item will store in the collection.
That’s it! We can see that when we insert any item in the text control and click on the button, the collection (that is connected to the gallery) will get that value from the text input. After that, the text input control will be reset to blank.
This is how to get an item from the Power Apps text input control.
Check out: Power Apps Set ThisItem Value [With Real Examples]
Get value from Power Apps text input using filter
In this section, we will see how to get value from Power Apps text input using the filter function. That means when the user inserts any text in the text input control the item will be within a gallery and will be filtered as per the inserted text value.
To achieve this requirement, the following steps are:
- We have a SharePoint list named Products List having different types of columns such as single line of text, date column, choice column, image, etc.
- On the Power Apps screen, we have created a horizontal gallery using the above SharePoint list as shown below:
- On the above screen, add a Power Apps text input control to insert the product’s company and give a name to the text input control.
- Insert the below expression on the horizontal gallery’s Items property.
Items = Filter(
'Products List',
Company.Value = Company_txt.Text
)
Where Company_txt is the name of the Power Apps text input control. As the company is a choice column, it is denoted as Company.Value.
- Let’s preview the app and insert a specific company name from the list. We can see the galley will display only the data whose value match to the text input value.
This is how to get value from Power Apps text input control using a filter function.
Have a look: How to Select First Item in a Power Apps Gallery
Get value from Power Apps text input using the search()
In this section, we will see how to get the items from the Power Apps text input control using the search function.
That means, when the user inserts any text input control, it will search the items that contain that given text and display those items within a Power Apps gallery.
To work with this scenario, we are going to use the above Power Apps gallery and the following steps are:
- On the Power Apps screen, insert the below expression on the horizontal gallery’s Items property.
Items = Search(
'Products List',
Products_txt.Text,
"Title"
)
Where Products_txt is the name of the Power Apps text input control and “Title” is the name of the SharePoint list column name.
Let’s preview the app and insert a text within the text input control. Now, we can see that the gallery will display only those items whose title contains the specified text from the text input control.
This is how to get the value from a Power Apps text input control using the search function.
Get password value from Power Apps text input
In this section, we will see how to get password value from a Power Apps text input control. That means, when the user inserts their password via Power Apps text control, it will retrieve that password value from the text input control and collect them on a collection.
To work with this scenario, the following steps are:
- On the Power Apps screen, add two text input controls for inserting the user’s ID and password.
- On the second text input control, set the Mode as Password.
- Add a button control to the above Power Apps screen that will store the data in a secondary storage or collection. Also, give a text to the button control i.e., Save.
- Next, insert the below expression on the button’s OnSelect property.
OnSelect = Collect(
ColUser,
{
UserID: UserID_txtInput.Text,
Password: Password_txtInput.Text
}
)
Where,
- ColUser is the name of the collection to store the users’ names and passwords.
- UserID_txtInput and Password_txtInput are the names of the text input controls for the user’s name and password respectively.
- Let’s add a data table control to the above Power Apps screen and connect that data table to the ColUser.
- Add the fields (i.e., User ID and Password) to the data table.
- Save, publish, and preview the app for now. Insert a user ID, and password into the text input control and press the button control.
- We can see that the data table is showing the user ID and password as shown below:
This is how to get the password value from the Power Apps text input control.
Furthermore, you may like some more Power Apps tutorials:
- How to get selected value from gallery in Power Apps?
- How to add text input to Power Apps collection?
- Power Automate Dataverse Update Multiple Rows
- How to format a currency column in Power Apps?
- Power Automate Dataverse Upload a File or an Image
Conclusion
From the above Power Apps Tutorial, we learned how to get value from the Power Apps text input control based on different scenarios such as:
- Power Apps get value from text input
- How to get value from a Power Apps text input using a filter function
- How to get value from the Power Apps text input using the search()
- How to get a password value from Power Apps text input
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.