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

Button disabled if a (OnSelect) function is activated

Hey guys, 

 

Ill try to make this as simple as possible

I have a submit button that is disabled until some text is entered somewhere else on the app. That works fine.  I also need a trigger function for the same button so that if a text label is selected (OnSelect) it creates a pop up text box that until it has some text entered will also lock the same submit button. 

 

Any help would be great, but the less technical the better! "im still a noob" Smiley Frustrated

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
JimmyBecks
Level: Powered On

Re: Button disabled if a (OnSelect) function is activated

Hey Courtney,

 

From reading your message I think you are looking for something like this when a user clicks on the trigger text:

TriggerTextDemo.PNG

 

where the text input has been revealed and disables the button until it is populated. To achieve this I added 2 formulas, one to the OnSelect property of the label ("Trigger Label") and one to the DisplayMode property on the button as well as tweeking the visability value of the TextInput.

 

On the Label I put the following formula:

 

UpdateContext({_showPopUpBox:true})

 

which sets a local variable "_showPopUpBox" to true. This is the value I used for the visibility field for the TextInput control.

 

I then added the following formula to the Button:

 

If(_showPopUpBox And IsBlank(TextInput1.Text),Disabled,Edit)

 

which checks if the TextInput field has been revealed and if it has and there is no text in it set the Button to be disabled. Remember to ensure that the default value of the TextInput has been cleared in the control's settings.

 

On other thing I might add would be

Reset(TextInput1)

on the trigger label OnSelect property before the UpdateContext. This would clear the text box before revealing it.

 

Hopefully that is what you were trying to do Smiley Very Happy

4 REPLIES 4

Re: Button disabled if a (OnSelect) function is activated

Could you provide some screenshots so that I can better understand what you need and help you further Smiley Happy

 

Highlighted
JimmyBecks
Level: Powered On

Re: Button disabled if a (OnSelect) function is activated

Hey Courtney,

 

From reading your message I think you are looking for something like this when a user clicks on the trigger text:

TriggerTextDemo.PNG

 

where the text input has been revealed and disables the button until it is populated. To achieve this I added 2 formulas, one to the OnSelect property of the label ("Trigger Label") and one to the DisplayMode property on the button as well as tweeking the visability value of the TextInput.

 

On the Label I put the following formula:

 

UpdateContext({_showPopUpBox:true})

 

which sets a local variable "_showPopUpBox" to true. This is the value I used for the visibility field for the TextInput control.

 

I then added the following formula to the Button:

 

If(_showPopUpBox And IsBlank(TextInput1.Text),Disabled,Edit)

 

which checks if the TextInput field has been revealed and if it has and there is no text in it set the Button to be disabled. Remember to ensure that the default value of the TextInput has been cleared in the control's settings.

 

On other thing I might add would be

Reset(TextInput1)

on the trigger label OnSelect property before the UpdateContext. This would clear the text box before revealing it.

 

Hopefully that is what you were trying to do Smiley Very Happy

Administrator
Administrator

Re: Button disabled if a (OnSelect) function is activated

Welcome to the community @Courtney ! Can you review the above replies and update the thread if they were helpful? 

 

Thank you,

 

@TopShelf-MSFT 

Courtney
Level: Powered On

Re: Button disabled if a (OnSelect) function is activated

Perfect, thank you!

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 292 members 4,039 guests
Please welcome our newest community members: