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 / How do you disable but...
Power Apps
Unanswered

How do you disable button when data is present in a column either a in gallery or SharePoint List

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

 

I am in the process of creating a mileage submission app where users can add there business trips. Without going into to much detail, what I'm trying to achieve is that the user can only update a field within a form and submit it once. Once that field contains data then the submit button is disabled indefinitely . When the user updates the field with the mileage they also need to tick a checkbox which then write true back to the List under a Declaration column so I figured this would be a useful field to use for a lookup.

Screenshot 2024-01-16 142334.png

 

I already have the submit button disable if this checkbox hasn't been ticked using the code:

 

If(DataCardValue18.Value=true,DisplayMode.Edit,DisplayMode.Disabled)

 

I've been trying to either lookup a field within either the List or an embedded Gallery that contains the true value (Declaration field) and then disable the button if the value is true. 

 

List Name: mileagesubmissions

GalleryName: CalculateMileageGallery

Field user update: 'End Odometer Reading'

Possible field to use for lookup: Declaration (checkbox, true/false)

 

I've been struggling to write this in the correct way for a while and just can't quite get it to work so any help would be so greatly appreciated.

 

Many thanks in advance

Categories:
  • KaiE Profile Picture
    39 on at

    Hi

     

    Maybe something like this:

     

    If(ThisItem.Declaration; DisplayMode.Edit;DisplayMode.Disabled)
    
    OR
    
    If(ThisItem.Declaration, DisplayMode.Edit,DisplayMode.Disabled)
    
    OR
    
    If(ThisItem.Declaration = true; DisplayMode.Edit;DisplayMode.Disabled)
    
    OR
    
    If(ThisItem.Declaration = true, DisplayMode.Edit,DisplayMode.Disabled)

     

    If the button is not a child of the form -> 

    //Set SelectedRecord at OnSelect in the gallery
    
    Set(SelectedRecord; CalculateMileageGallery.Selected)
    
    //Code for button DisplayMode
    
    If(SelectedRecord.Declaration;DisplayMode.Edit;DisplayMode.Disabled)
    
    OR
    
    //Set SelectedRecord at OnSelect in the gallery
    
    Set(SelectedRecord, CalculateMileageGallery.Selected)
    
    //Code for button DisplayMode
    
    If(SelectedRecord.Declaration,DisplayMode.Edit,DisplayMode.Disabled)

     

  • powerclark Profile Picture
    10 on at

    Thanks for this. Unfortunately it doesn't work as expected. 

     

    I'm guessing it's because the declaration checkbox is part of a form and the submit button sits outside of both form and gallery. 

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard