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

Dynamically add a new control (text input for example) after clicking a button

Hello PowerUsers !

Is there a way that allows me to dynamically create a new text field?

 

For example:

I have a button "Add a new field" in my screen, if I click on this button I want a new text field appears in the same screen. And if I click again I want a 2nd text field to appear below. A bit like To do list in javascript and HTML ...

Thanks ...

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dynamically add a new control (text input for example) after clicking a button

Hi @zdridos,

 

Do you want to add a Text input control dynamically within the screen of your app when you click the Button control?

 

If you want to add a Text input control (or other controls) dynamically within the screen of your app when your click the Button control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum :
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, you could consider take a try to embed the Text input control into a Gallery control. I have made a test on my side, please take a try with the following workaround:3.JPG

 

4.JPG

 

 

  • Set the OnVisible property of the screen of your app to following formula:
ClearCollect(ItemsCollection,0)
  • Add a Gallery control within the screen of your app. Set the Items property of the Gallery control to following formula:
ItemsCollection
  • Within the Gallery control, add a Text input control.
  • Add a Button control within the screen, set the OnSelect property of the Button control to following formula:
Collect(ItemsCollection,CountRows(ItemsCollection))

The GIF image as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Rick72
Level 10

Re: Dynamically add a new control (text input for example) after clicking a button

Hi @zdridos,

 

Nope. Nocando. There is no way to dynamically add a control.

 

Perhaps you can make something to work with the same controls, variables, a gallery/table, the patch and refresh functions? I thought I saw a video about something like that once but cannot find it anymore.

 

The controls and the button add a new item to a collection. A refresh make the newly added item visible, Somethng like that.

 

Robot Happy Rick

Community Support Team
Community Support Team

Re: Dynamically add a new control (text input for example) after clicking a button

Hi @zdridos,

 

Do you want to add a Text input control dynamically within the screen of your app when you click the Button control?

 

If you want to add a Text input control (or other controls) dynamically within the screen of your app when your click the Button control, I afraid that there is no way to achieve your needs in PowerApps currently.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum :
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

As an alternative solution, you could consider take a try to embed the Text input control into a Gallery control. I have made a test on my side, please take a try with the following workaround:3.JPG

 

4.JPG

 

 

  • Set the OnVisible property of the screen of your app to following formula:
ClearCollect(ItemsCollection,0)
  • Add a Gallery control within the screen of your app. Set the Items property of the Gallery control to following formula:
ItemsCollection
  • Within the Gallery control, add a Text input control.
  • Add a Button control within the screen, set the OnSelect property of the Button control to following formula:
Collect(ItemsCollection,CountRows(ItemsCollection))

The GIF image as below:Test1.gif

 

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

zdridos
Level: Powered On

Re: Dynamically add a new control (text input for example) after clicking a button

Thank you @v-xida-msft , this is exactly what I need !
Best regards !

Sharmila
Level: Powered On

Re: Dynamically add a new control (text input for example) after clicking a button

Its working but if I have entered some value in the text box , on clicking the button to add new row clears the text in the previous row , and this doesnt replicate consistently . Do help me in solving this.
Rick72
Level 10

Re: Dynamically add a new control (text input for example) after clicking a button

Perhaps you are using "ClearCollect" instead of "Collect"?
Highlighted
eliu
Level: Powered On

Re: Dynamically add a new control (text input for example) after clicking a button

Thanks for the excellent sharing!

 

One question: How do you access the data  or content in those dynamic controls? Using the same example, the text input, how do I access the content of the the second, third textfield text that are generated dynamically? 

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 197 members 6,220 guests
Please welcome our newest community members: