Hello,,
How can i disable file property on the form using Javascript.onformpopulated

Hello,,
How can i disable file property on the form using Javascript.onformpopulated

Hi HKhan
This can be achieved using below code (Use this method in onformpopulate event)
Before Change

Using Below Code (Entire element will be disabled)
const displayName = document.getElementsByName('native_file')[0];
if(somecondition)
{
displayName.style.display = 'none';
}
else
{
displayName.style.display = 'inline';
}

Using Below Code (Label will display but only upload will be hidden)
const fileItem = document.getElementsByName('native_file')[1];
if(somecondition)
{
fileItem.style.display = 'none';
}
else
{
fileItem.style.display = 'inline';
}

Hi HKhan
This can be achieved using below code (Use this method in onformpopulate event)
Before Change

Using Below Code (Entire element will be disabled)
const displayName = document.getElementsByName('native_file')[0];
if(somecondition)
{
displayName.style.display = 'none';
}
else
{
displayName.style.display = 'inline';
}

Using Below Code (Label will display but only upload will be hidden)
const fileItem = document.getElementsByName('native_file')[1];
if(somecondition)
{
fileItem.style.display = 'none';
}
else
{
fileItem.style.display = 'inline';
}

Copyright © 2025 Aras. All rights reserved.