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

Community site session details

Session Id : 3Z8XBaVwCcSITLFqC260H1
Power Apps - Building Power Apps
Answered

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

Like (3) ShareShare
ReportReport
Posted on 17 Aug 2018 15:39:26 by

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 ...

Categories:
I have the same question (0)
  • Rick72 Profile Picture
    385 on 19 Aug 2018 at 17:40:44
    Re: Dynamically add a new control (text input for example) after clicking a button

    Hi @Anonymous,

     

    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

  • Verified answer
    v-xida-msft Profile Picture
    on 20 Aug 2018 at 07:34:05
    Re: Dynamically add a new control (text input for example) after clicking a button

    Hi @Anonymous,

     

    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 Power Platform Member Profile Picture
    on 20 Aug 2018 at 13:50:33
    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 !

  • Community Power Platform Member Profile Picture
    on 07 Jan 2019 at 13:25:25
    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 Profile Picture
    385 on 07 Jan 2019 at 21:38:30
    Re: Dynamically add a new control (text input for example) after clicking a button
    Perhaps you are using "ClearCollect" instead of "Collect"?
  • Community Power Platform Member Profile Picture
    on 13 Feb 2019 at 01:46:00
    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? 

  • DeevyaAskoolum Profile Picture
    23 on 29 Jan 2020 at 07:43:09
    Re: Dynamically add a new control (text input for example) after clicking a button

    Hello Kris,

     

    Thank you for posting the work around, it really helps.

     

    I tried to implement same on my app, however the "add new text input button" does not work, the button does not dynamically add new text input control on the gallery.

     

    I guess the issue is related with the button or the gallery Items property, I would be more than happy if you could help me troubleshoot and fix the control.

     

    You will find below the controls on the app

     

    1. Added the following on OnVisible property :

    ClearCollect(Projectcollection,0)

    2. The Gallery used is filtering data based from the 'Property Manager dropdown'. The items property is set to: 

    Filter(Properties, 'Property Manager' = Dropdown_PropertyManager.Selected.'Property Manager')

    3. Add a text input control "Add Project" on the Gallery:

    Capture.png

     

    4. Added a button and set the OnSelect property to: 

    Collect((Properties),CountRows(Projectcollection))

     

  • shengaimani Profile Picture
    8 on 28 Apr 2020 at 03:38:32
    Re: Dynamically add a new control (text input for example) after clicking a button

    Thanks, but item collection values are empty and not able to retrieve. For Eg. I have added two text box and entered values but Itemcollection shows values 0,1 and also empty string values to capture 

  • Changal Profile Picture
    62 on 31 May 2022 at 06:26:54
    Re: Dynamically add a new control (text input for example) after clicking a button

    Hi Kris,

             Your post was really helpful.  Can we add  a label or text input instead of button to enter the number of required TEXT INPUTS. If yes then what functionality we need to add to the label to make it work. For example if i enter 50 in the  label or text input, then 50 text inputs need to generate.

  • NidjoJohnny22 Profile Picture
    288 on 18 Aug 2023 at 09:06:56
    Re: Dynamically add a new control (text input for example) after clicking a button

    Hi, I'm having trouble because my first input row data is being deleted when I intend to create a new row. any advice with collections to override the issue?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 686 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 433 Super User 2025 Season 2

#3
wolenberg_ Profile Picture

wolenberg_ 266 Moderator

Last 30 days Overall leaderboard
Loading complete