web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Onstart displaymode bu...
Power Apps
Answered

Onstart displaymode button

(0) ShareShare
ReportReport
Posted on by

Hello all

 

I want to enable(displaymode) a button onstart based on internet available. If internet available then button enabled if not internet then grey out button.

I have tried code below but doesnt work. Having or not having internet, button is always enabled.

 

If(Connection.Connected,Button2.DisplayMode.Edit,Button2.DisplayMode.Disabled);

 

on button2 Displaymode properties it is left in blank.

 

Second question is also related to onstart.

 

I have a dropdown with months of the year. I want onstart dropdown be setup accord to current month.

I tried code below but no success.

Dropdown1.Selected.Value = Text(Today(), "[$-en-US]mmmm") 

 

Thanks in advance for any help

 

Categories:
I have the same question (0)
  • Verified answer
    FabianAckeret Profile Picture
    969 on at

    Hi @Faribeiro 

     

    Your formula is basically correct. However, you can't set values directly in other fields. You'd need to set variables and use those variables in the corresponding properties.

     

    So, your first formula:

     

    // incorrect
    If(Connection.Connected,Button2.DisplayMode.Edit,Button2.DisplayMode.Disabled);
    
    // correct
    If(Connection.Connected,Set(gblDisplayMode,DisplayMode.Edit),Set(gblDisplayMode,DisplayMode.Disabled))

     

    Now you just need to set gblDisplayMode to the Button2.DisplayMode property.

     

    Your second question is the same. Set a variable instead of trying to set a value to a different field directly.

     

    // incorrect
    Dropdown1.Selected.Value = Text(Today(), "[$-en-US]mmmm") 
    
    // correct
    Set(gblToday, Text(Today(), "[$-en-US]mmmm")

     

     

    and then set the gblToday variable to the Dropdown1.Default property. Alternatively, you can set Text(Today(), "[$-en-US]mmmm") directly to the Dropdown1.Default property.

     

    I hope this helps.


    Please click Accept as Solution if my post answered your question. Like my answer? Consider giving it a Thumbs Up. Others seeking the same answers will be happy you did.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Faribeiro 

    Consider the following - Instead of setting a variable (very much overused in PowerApps), have your control derive its state from the Connection object.  Set the DisplayMode property of Button1 to the following:

    If(Connection.Connected, DisplayMode.Edit, DisplayMode.Disabled)

     

    As for the DropDown - you need to set the Default property of that control to what you want.  If it is truly a DropDown, you cannot select multiple items, so default is the only property you need to deal with.  Default formula:

    Text(Today(), "mmmm")

     

    No variables needed for either.

     

    I hope this is helpful for you.

  • Faribeiro Profile Picture
    on at

    tks Isabasu and RandyHayes.....much appreciate for the prompt answer. Both did work great!!!!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 88

#2
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 45

Last 30 days Overall leaderboard