cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Powerquery
Helper I
Helper I

How can I disable button once user summitted the data?

My scenario: I am preparing a form where on view list approver have three button 'approve' ,'reject' ,'edit'   .

I am getting error invalid use of button 

On clicking approve /reject data is updated in SharePoint, but I want to disabled it from next view onwards and on clicking edit button approver only have a form view list not edit .

Waiting for a solution .trying different methods by reading blogs and YouTube views but no results . If any one from community help me it will be great and thanks in advance 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Powerquery ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

View solution in original post

14 REPLIES 14
WarrenBelz
Super User
Super User

Hi @Powerquery ,

It appears you have a gallery there and I assume the buttons are in this gallery. You have not shared the code you are getting an error, so please do this (in text). As far as the View Mode, you will need to have a field (Status would be a good name) in your list that you update when the button is actioned and then base the mode of the form on the value of this field.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

If(ThisItem.Status.Value="Approved",DisplayMode.Disabled,DisplayMode.Edit) .I am using this formula and getting error as invalid use of display button. in the question i have attached the my view screenshot . 

Thanks for replying 

Hi @Powerquery ,

Your formula 

If(
   ThisItem.Status.Value="Approved",
   DisplayMode.Disabled,
   DisplayMode.Edit
) 

would be valid on the DisplayMode of the Button providing

  • You had a Choice field called Status in your list AND
  • The button was in the gallery containing this record.

 What is not correct here?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Hi @WarrenBelz , Thanks for response. my apologies , my question is first in the gallery form first the approver will approve the concerned form using Approve button .once that will happen after that no one should change the status in sharepoint and that approve button should disabled ,is that possible ? First I am using the Patch function to change the form status and then want to change the button to disable.

@Powerquery ,

As I posted the formula on the DisplayMode of the button

If(
   ThisItem.Status.Value="Approved",
   DisplayMode.Disabled,
   DisplayMode.Edit
) 

will disable the button the moment the Status field in the record is updated to Approved. You can base the behaviour of any other control in the gallery or action initiated by it on the value of Status. Is that what you are asking?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

Powerquery
Helper I
Helper I

But for me  it worked without using .value  and button disabled .

If (
ThisItem.Status = "Approved",
DisplayMode.Disabled,
DisplayMode.Edit
)

Thanks for the input. Could you tell me is there any way to change the button text like on disable the text button should change to  Approve to Approved ? or from blue color button to green .

@Powerquery ,

I copied the .Value from your code assuming it was a Choice field. If Status is a Text field, then you do not need .Value. For the button Text, put on the Text property

If(
   ThisItem.Status="Approved",
   "YourFirstTextHere",
   "YourSecondTextHere"
) 

and the Color

If(
   ThisItem.Status="Approved",
   Red,
   Blue
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

WarrenBelz
Super User
Super User

Hi @Powerquery ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Powerquery
Helper I
Helper I

@WarrenBelz , Thanks for the response , like if you remember i am using a form to approve and reject button ,is there a way where I can use drop down list of approve or reject and once the action taken the drop down list will be disabled for the approver and color can be changed to green on approve and other call on reject . instead of different approve and reject button .Attached the snippet of my form .

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,078)