cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Disable / Enable buttons

AccessReport.jpg

 

I have a datacard that contains a on/off switch (yes/no field from my sharepoint list) and a textfield. I would like the Access Report button to be disabled until the on/off switch = On and the Electronic Signature field contains a value.

 

Once the button is enabled and pressed, it would send that data to the SharePoint list.

 

Also, is it possible to make another button available ONLY AFTER the Access Report button is pressed? I want users to access another page using another button.

8 REPLIES 8
Highlighted
Memorable Member
Memorable Member

Re: Disable / Enable buttons

Simply have a variable assigned to yes or no and then use it in the DisplayMode field of whatever needs disabling/enabling.

 

Set your page On Visible to make a variable false (or wherever convenient):

 

UpdateContext({ClickableYesNo: false})

 

Put the variable in the button being pressed to change to true:

 

 

UpdateContext({ClickableYesNo: true})

 

 

And then set your DisplayMode to:

 

If(ClickableYesNo = true, DisplayMode.Edit, DisplayMode.Disabled)

 

This will disable it until true is found in whatever variable name you pick.

 

Hope that leads you to the right answer!

 

 

Highlighted
Anonymous
Not applicable

Re: Disable / Enable buttons

Should I copy & paste the code into those advanced properties fields? Or should I use the actual names of those fields (instead of clickableyesno)?

 

Copying and pasting did disable the button, but when I update the yes/no field to YES, the button is still disabled.

Highlighted
Anonymous
Not applicable

Re: Disable / Enable buttons

Also, for the button, if OnSelect = "

UpdateContext({ClickableYesNo: true})", how can I get the button to submit the data to the sharepoint list? Nothing happens when I click on the button.

Highlighted
Memorable Member
Memorable Member

Re: Disable / Enable buttons


@Anonymous wrote:

Also, for the button, if OnSelect = "

UpdateContext({ClickableYesNo: true})", how can I get the button to submit the data to the sharepoint list? Nothing happens when I click on the button.


 

You can have a button or actionable item run more than one set of code by using a ; between code.

 

For example:

 

UpdateContext({ClickableYesNo: true}) ; UpdateContext({Clickable2YesNo: true})

That will make both variables listed true.

 

 

Highlighted
Memorable Member
Memorable Member

Re: Disable / Enable buttons


@Anonymous wrote:

Should I copy & paste the code into those advanced properties fields? Or should I use the actual names of those fields (instead of clickableyesno)?

 

Copying and pasting did disable the button, but when I update the yes/no field to YES, the button is still disabled.


 

ClickableYesNo is just a random example variable I wrote, you can make it anything you want.

 

 

Highlighted
Anonymous
Not applicable

Re: Disable / Enable buttons

UpdateContext({DataCardValue2: true});SubmitForm(Form1);Navigate(Screen2,ScreenTransition.Cover)

 

Thsi is my code for the button OnSelect. I need the button to submit the data to a sharepoint list as well as navigating to another screen in the app. However, the data is not being submitted to the list, but the button navigates to the next screen.

 

 

Error.jpg

Highlighted
Memorable Member
Memorable Member

Re: Disable / Enable buttons


@Anonymous wrote:

UpdateContext({DataCardValue2: true});SubmitForm(Form1);Navigate(Screen2,ScreenTransition.Cover)

 

Thsi is my code for the button OnSelect. I need the button to submit the data to a sharepoint list as well as navigating to another screen in the app. However, the data is not being submitted to the list, but the button navigates to the next screen.

 

 

Error.jpg


 

What is the yellow exclamation mark saying when you mouse over? That's going to contain the answer as to what's going wrong.

Highlighted
Anonymous
Not applicable

Re: Disable / Enable buttons

It says "Title:Field Required"

 

Title is the textbox in the screenshot. It is a required field. User click on the yes/no field, enter a value in the textbox, and then click the button to submit and navigate to the next screen. That's the goal.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

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 (6,561)