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

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
Highlighted
Resolver II
Resolver II

Re: Replace text of a DataCardValue on Button click

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
Highlighted
Resolver II
Resolver II

Re: Replace text of a DataCardValue on Button click

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

Highlighted
Helper II
Helper II

Re: Replace text of a DataCardValue on Button click

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?

Highlighted
Resolver II
Resolver II

Re: Replace text of a DataCardValue on Button click

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

Helper IV
Helper IV

Re: Replace text of a DataCardValue on Button click

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,960)