cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gautmish
Helper III
Helper III

Create data field on button click

Hi

 

I want to generate textbox in the form on button click . 

 

Scenario : Form with Quote field , number of quote may change in each request . So I want to provide an add button to user, on-click it should add one more textbox to add a new quote . I know i can not create a new column on SP list but I can store all the quotes with comma separated . So I just want to build the form for enduser , where they will fill quotes in different text fields.

 

Please let me know if you need any more information .

 

Thanks

Gautmish

1 ACCEPTED SOLUTION

Accepted Solutions
v-monli-msft
Community Support
Community Support

Hi @gautmish,

 

This can be achieved, but not inside a Form control. You need to create the textinput control outside the form, and then use a Patch function to update the records to SharePoint list. 

 

In Screen1, add multipleTextInput controls and a button control, set below formulas to make this work:

 

Screen1.OnVisible=Set(Number,1)
Button1.OnSelect=Set(Number,Number+1)
TextInput2.Visible=If(Number>=2,true,false)
TextInput3.Visible=If(Number>=3,true,false)
TextInput4.Visible=If(Number>=4,true,false)
...
....
.....

About how to use Patch to create a new record, the formula should be something like:

Patch(List,Defaults(List),
{Title:
Concatenate(TextInput1.Text," ",TextInput2.Text," ",TextInput3.Text),
...})

 Capture.PNG

 

Regards,

Mona

Community Support Team _ Mona Li
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

5 REPLIES 5
Pat_Wickramage
Helper III
Helper III

Hi @gautmish

 

To add a field at button click, you can use popup.

Basically insert a text box & set the 'visible' parameter to Popup = true

And insert a button and put 'onselect' parameter to Updatecontext({Popup: true}).

 

So when a user clicks on the button the text box would appear.

One more thing, on your 'Save' button again use 'Updatecontext' to make Popup:false.

 

Then the text box would be gone after saving.

Hi @Pat_Wickramage,

 

Thank you for your Reply . As i have mentioned , we are not sure , how many quotes we needed per request . So it will be difficult to create predefined textboxes and change the visible property . 

 

Thanks

Gautmish

Noted. I had a similar requirement sometime back & de client was happy with 3 new fields. So it wasnt a major issue for me.

Good luck.

v-monli-msft
Community Support
Community Support

Hi @gautmish,

 

This can be achieved, but not inside a Form control. You need to create the textinput control outside the form, and then use a Patch function to update the records to SharePoint list. 

 

In Screen1, add multipleTextInput controls and a button control, set below formulas to make this work:

 

Screen1.OnVisible=Set(Number,1)
Button1.OnSelect=Set(Number,Number+1)
TextInput2.Visible=If(Number>=2,true,false)
TextInput3.Visible=If(Number>=3,true,false)
TextInput4.Visible=If(Number>=4,true,false)
...
....
.....

About how to use Patch to create a new record, the formula should be something like:

Patch(List,Defaults(List),
{Title:
Concatenate(TextInput1.Text," ",TextInput2.Text," ",TextInput3.Text),
...})

 Capture.PNG

 

Regards,

Mona

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

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,289)