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

Set a text field value pressing a button on SharePoint list form

Hello,

 

I would like to set a text field value on pressing a button. Once the value is set, the button's display mode should also be set to "disabled".

 

I tried several solutions using patch, updatecontext, Button rules etc that are already posted on the forums but none of them really work. Can anyone help me with right steps to accomplish this?

Thanks

 

9 REPLIES 9
Highlighted
Dual Super User II
Dual Super User II

Re: Set a text field value pressing a button on SharePoint list form

Hi @cooltechie 

 

On click of the button

 

Reset(TextInputControlName); Set(varTextValue,"your value");Set(varMode,Disabled)

 

for Text Input Control set default property to varTextValue

for button mode property set value to varMode

 

On visible of the screen Set(varMode,Edit ) - to reactivate the button

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Helper IV
Helper IV

Re: Set a text field value pressing a button on SharePoint list form

Hi Reza,

 

Thank you for your reply. However, I have following questions:

 

in the Reset(TextInputcontrolName) should the text input contro name be the DataCardValuexx  or display name of the SharePoint list field?

 

Also, I do not want to reactivate the button once the textfield value is set to "Yes".

 

Please advise,

Highlighted
Dual Super User II
Dual Super User II

Re: Set a text field value pressing a button on SharePoint list form

Hi @cooltechie 

 

that would be the name of the datecardcontrol for text field

Highlighted
Helper IV
Helper IV

Re: Set a text field value pressing a button on SharePoint list form

also, On clicking the button, any other changes made on the form should also be saved. Should I include

 

Submitform(SharePointForm1) as well?

Highlighted
Helper IV
Helper IV

Re: Set a text field value pressing a button on SharePoint list form

DataCardControl or DataCardControlValue?

Highlighted
Dual Super User II
Dual Super User II

Re: Set a text field value pressing a button on SharePoint list form

Hi @cooltechie 

 

DataCardControlValue

Highlighted
Helper IV
Helper IV

Re: Set a text field value pressing a button on SharePoint list form

Hi Reza,

 

Thank you for your answer but it did not work. 

Highlighted
Community Support
Community Support

Re: Set a text field value pressing a button on SharePoint list form

Hi @cooltechie ,

Do you want to update a text field value by clicking a button and then make the button disabled?

Could you tell me what control that you want to use to update this value?

I assume that you use a textinput control to update this value, so I use "controlname.Text" to represent value.

If so, I suggest you set the button's OnSelect:

Patch(tablename,LookUp(tablename,....),{fieldname:controlname.Text});Set(var,a)   
//LookUp(tablename,....) means that the item that you want to update

Set the button's DisplayMode:

If(IsBlank(var),DisplayMode.Edit,Disabled)

Please replace tablename,fieldname, controlname with the names that you use. 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Set a text field value pressing a button on SharePoint list form

Yutliu,

 

I am doing this on a PowerApps form that is based on a SharePoint list. In that case, how should I modify the code below?

 

atch(tablename,LookUp(tablename,....),{fieldname:controlname.Text});Set(var,a)   
//LookUp(tablename,....) means that the item that you want to update

Set the button's DisplayMode:

If(IsBlank(var),DisplayMode.Edit,Disabled)

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,748)