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

Replace text of a DataCardValue on Button click

Hello,

 

I am trying to replace the value of a DataCard on the click of a button.

 

As a bit of a background I have created a SharePoint Edit Form that is split into two Screens ('Approval' & 'Change'). Each Form has a Button to submit any changes.

 

There is a DataCard on both Screens called DataCardValue44 (aka Requires Approval).

 

I would like that:

If you click the Submit Button on the Approval Screen it populates DataCardValue44 with Yes

&

If you click the Submit Button on the Change Screen it populates DataCardValue44 with No.

 

I have tried on the Submit Button:

OnSelect: 
UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

But this isnt working, would anyone know what the issue is?

1 ACCEPTED SOLUTION

Accepted Solutions
PK_Hong
Helper V
Helper V

Hi @TWolsten

 

OnSelect: UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

From the above, I would suggest to check on:

- Inside the DataCardValuee44, which I assume to have a LABEL (which has a TEXT value) or TEXTINPUT (which has a DEFAULTS value).

Please set with a Context Variable, say myresult

- Label.Text = myresult or

- TextInput.Default = myresult

 

then

UpdateContext({myresult: "Yes"})

 

We are updating the Context Variable, NOT the name of the DataCard.

 

Hope this helps,

View solution in original post

4 REPLIES 4
PK_Hong
Helper V
Helper V

Hi @TWolsten

 

OnSelect: UpdateContext({DataCardValue44:"Yes"}); SubmitForm(NewItemForm)

 

From the above, I would suggest to check on:

- Inside the DataCardValuee44, which I assume to have a LABEL (which has a TEXT value) or TEXTINPUT (which has a DEFAULTS value).

Please set with a Context Variable, say myresult

- Label.Text = myresult or

- TextInput.Default = myresult

 

then

UpdateContext({myresult: "Yes"})

 

We are updating the Context Variable, NOT the name of the DataCard.

 

Hope this helps,

Thank you for that! It worked perfectly.

 

Out of interest I am trying to filter on a ComboBox Value, the forumla of:

 

Filter(lookup, DataCardValue109.SelectedItems.Results = Project_x0020_No_x002e_)

Does not work, would you know why this is?

Hi @TWolsten

 

Welcome.

Please always use

.Selected.Results

 

I am not sure why SelectedItems is there because I have also never successfuly used it.

 

Either in Dropdown or Combo, use Selected.Results or Selected.Value.

 

Please try. TQ

G9

MK1
Helper IV
Helper IV

Hi

In my scenario,

When we try to submit a new request to Add and Remove User.

I have two buttons, Add and Remove on my  one edit screen.

When we click on Add button  datacardvalue17 should be null.

when we click on Remove button datacardvalue17 should be populated as "Remove".

And the Datacardvalue should set to null once the form is submitted.

Any ideas how to fix this would help.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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