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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / File input on form - h...
Power Apps
Unanswered

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard