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

Add to text field and submit a form when a button is pressed

I am sure this is a very stupid question but I am failing to figure it out.

 

What is the best way to insert into a text field and submit a form when a button is pressed? 

 

I using a SharePoint list as the data source.

 

This is what I thought would be the correct way to do it, however, it is not working:

UpdateContext({Status_DataCard1:"Pending"});SubmitForm(EditFormSave)

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Set the text in a variable and keep the default property of the label to this variable.

Something like:

UpdateContext({textVar:"Pending"});SubmitForm(EditFormSave)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

7 REPLIES 7
Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Set the text in a variable and keep the default property of the label to this variable.

Something like:

UpdateContext({textVar:"Pending"});SubmitForm(EditFormSave)

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com

View solution in original post

Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Also if Pending is a value of an Option Set you will have to reference it a bit differently.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
The Power Addict
https://thepoweraddict.com
eka24
Level 10

Re: Add to text field and submit a form when a button is pressed

Set a variable on the SubmitButton : Set(MyText,"Pending");
SubmitForm(EditFormSave)

Then in the default of the textbox put the variable name: MyText
randywade
Level: Powered On

Re: Add to text field and submit a form when a button is pressed

Your solution did work for adding text when a button is pressed @PowerAddict . However, now I realized that I will need a way for the text to disappear when a new form is created. 

 

I am trying to create a save and submit buttons for my app my using a column named "Status". My plan was to insert "Pending" when the save button is pressed and "submitted" when the submit button is pressed.

Super User
Super User

Re: Add to text field and submit a form when a button is pressed

If you simply want your text to disappear when you are creating a new record, set the Default property of the label to:
If(FormName.Mode = FormMode.Edit, "Pending", Parent.Default)

The second part of your question: IS the only remaining part where you want to set the value to Submitted when the Submit button is pressed? Is this also in the same label that we have been referencing here?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com
randywade
Level: Powered On

Re: Add to text field and submit a form when a button is pressed

I solved the problem of the text not disappearing by hiding that data card on the edit screen, since the user will not need to see it. Thank you for your help! @PowerAddict 

Super User
Super User

Re: Add to text field and submit a form when a button is pressed

Glad I could help! Good luck with the rest of the app! Feel free to reach out in case of any questions!

Thanks!
Hardit Bhatia
https://thepoweraddict.com

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,249)