cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cooltechie
Level: Powered On

Disable a button on form load based on a condition

Hello,

 

I have a button on my form and I would like to disable this button based on a certain value of the field.

 

the field is a single line of text field. If the value of this field is "Yes", then the submit button should be disabled. I tried various options with display mode on Form OnVisble property but nothing is working.

 

Please help

6 REPLIES 6
cooltechie
Level: Powered On

Re: Disable a button on form load based on a condition

I tried the following on DisplayMode property of the button but it didn't work

 

If(DataCardValue19.Text = "Yes", DisplayMode.Disabled, DisplayMode.Edit) Not sure what I  am doing wrong.  Can I use Button Rules instead?

Dual Super User
Dual Super User

Re: Disable a button on form load based on a condition

Hi @cooltechie 

 

Share a screenshot 

 

also check DataCardValue19.Text value by using a Label and setting its tet property to DataCardValue19.Text 

 

 

cooltechie
Level: Powered On

Re: Disable a button on form load based on a condition

the label also is not showing the text value.

Super User
Super User

Re: Disable a button on form load based on a condition

Are you sure DataCardValue19 is the name of the input control and can you provide a screenshot?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Community Support Team
Community Support Team

Re: Disable a button on form load based on a condition

Hi @cooltechie ,

Do you custom a form in your SP list using PowerApps?

Do you want to disable the Button based on a certain value of the field when you edit an existing record?

 

I have made a test on my side, please consider take a try with the following workaround:

Set the DisplayMode property of the Button to following:

If(
     SharePointIntegration.Selected.TextField = "Yes",
     DisplayMode.Disabled,
     DisplayMode.Edit
)

or

If(
     DataCardValue19.Text = "Yes",
     DisplayMode.Disabled,
     DisplayMode.Edit
)

Note: Please make sure the DataCardValue19 represents the Text Input box related to the Single text column of your SP list within your Edit form (SharePointForm1).

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
cooltechie
Level: Powered On

Re: Disable a button on form load based on a condition

I tried this approach. However, the problem with this is that the button is disabled even when the form is opened new and the value of the text field is blank.  How can we solve this?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,716)