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 / File input on form - h...
Power Apps
Answered

File input on form - how to lock? (PowerApps, model driven)

(0) ShareShare
ReportReport
Posted on by 7

Hi everyone,

We're using PowerApps to build a model driven app that uses the "file" type column in a table. As I understand it, this option hasn't been available for model driven apps for very long. The file upload control on a form works fairly well. It takes the selected file and stores this directly in the appropriate Dataverse table column. However, we cannot disable this file input with a business rule somehow. Business Rule editor simply doesn't give the option.

Knipsel.PNG

The plan is to use JavaScript to disable the input when it needs to be disabled. The JavaScript however does not get access to the targeted section (containing the button input we need to grab) using id (getElementById). The section ID can be controlled from the classic form edit view. So, if the section is grabbed, we can then search for the button and disable it. But the section appears to be generated after the onLoad event finishes. The result is, that I can grab the section when I run "document.getElementById('my_specific_section_id')" from the browser console, but when the application executes the script, it always results in null.

The section can't be found. This is only the case when using the file input form field. Other elements can be found as expected. In Dynamics365 user groups I was reading about how getlementById is not supported there. But given the fact that I can use this to grab other elements, I think it is not the case here.

What can I do to get the file input field disabled (as in "locked", unable to select a file, or delete one if one is already there)?

Best regards,
- Alex

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

    The answer, in my case, was to use formContext.getControl. A user on another forum was so kind as to put me in the right direction. Thank you.

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 993

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 545

Last 30 days Overall leaderboard