cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CYJ
Helper II
Helper II

Submitting default value text input field that is changed but trying to get the same default value when new form is clicked again

Hello everyone, i have text input field here. This is my default value for the text input field. I have disabled the display mode.

default value.PNG

 

I have another button to change the default value of the text input field when clicked.

true.PNG

 

Understandably clicking the button will change the 'false' value to 'true'.

false.PNG

Here is the problem that i am looking to solve. How do i set the default value back to 'false' the next time i click on New form?

true1.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-bofeng-msft
Community Support
Community Support

Hi @CYJ :

Could you tell me:

  • Are "new form" button  and "submitting the form" button the same button or two separate buttons?I assume there are two separate buttons.
  • Is "new form" button used to reset the form to New mode?

I've made a test for your reference:

1\Add a from(Form2)

2\Text Input control

Default:

 

If(value1,"true","false")

 

3\submitting the form button:

OnSelect:

 

UpdateContext({value1:true});SubmitForm(Form2)

 

4\New Form button:
OnSelect:

 

UpdateContext({value1:false});NewForm(Form2)

 

14.gif

Best Regards,

Bof

 

View solution in original post

7 REPLIES 7
mdevaney
Super User III
Super User III

@CYJ 

Like this...

UpdateContext({value1: Blank()})

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hi @mdevaney ,

 

I am not looking for a blank value. I want the default value to be 'false' every single time i click on the new form. After i have changed the 'false' value to 'true' using the button, i want to set back the value to 'false' again when the new form is clicked for the second time.  

mdevaney
Super User III
Super User III

@CYJ 

Same concept applies here

UpdateContext({value1: "False"});
NewForm(Form1);


---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hi @mdevaney ,

 

Can you explain to me further what you are doing here? I get the updateContext but i dont get the second line. And one more thing, for the default value of input field, do i leave the same or need to make some changes? Thanks

mdevaney
Super User III
Super User III

@CYJ 

You can use a single form to Edit, View and Create New records.  It is not necessary to have 3 forms on 3 separate screens to do this.

 

My code using the NewForm function clears all input from the current form and writes a new entry upon submission.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

 

@mdevaney 

 

I am still clueless a little. By the way, the false and true value are just used as an example. It can be of any value. i tried implementing your function but it doesn't seems to change the default value back when i clicked new form for the second time after submitting the form.  

v-bofeng-msft
Community Support
Community Support

Hi @CYJ :

Could you tell me:

  • Are "new form" button  and "submitting the form" button the same button or two separate buttons?I assume there are two separate buttons.
  • Is "new form" button used to reset the form to New mode?

I've made a test for your reference:

1\Add a from(Form2)

2\Text Input control

Default:

 

If(value1,"true","false")

 

3\submitting the form button:

OnSelect:

 

UpdateContext({value1:true});SubmitForm(Form2)

 

4\New Form button:
OnSelect:

 

UpdateContext({value1:false});NewForm(Form2)

 

14.gif

Best Regards,

Bof

 

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,345)