Sharepoint Document Library : Force to use form + disable name field

Hello,
I have two questions about this topic.

  1. How I can disable and hide the standard name field "FileLeafRef" when in another field changes the value?
  2. Is there a way to force to open the form when a new file uploaded in order to fill all the mandatory fields/properies?

About the first question I tried to use this code but the name field "FileLeafRef" is always editable.

fd.spRendered(function () {

fd.field('Status').disabled = true;
fd.field('Status').hidden = true;

        if (fd.field('Status').value == 'Expired') {
            fd.field('FileLeafRef').disabled = true;
            fd.field('Revision').disabled = true;
            fd.field('Expiration').disabled = true;
        }
});

Thank you.

Dear @stefano.mazzi,
You can also try hiding the field, like this:

fd.field('FileLeafRef').hidden = true;

It can also be done dynamically, like this:

fd.spRendered(function() {

    function hideOrShowName() {
        if (fd.field('Status').value == 'Expired') {
            // Hide the FileLeafRef field
            fd.field('FileLeafRef').hidden = true;
        } else {
            // Show the FileLeafRef field
            fd.field('FileLeafRef').hidden = false;
        }
    }

    // Calling hideOrShowName when the Status value changes
    fd.field('Status').$on('change',hideOrShowName);

    // Calling hideOrShowName on form loading
    hideOrShowName();

});

As for opening the form, where are the documents uploaded, directly in Document Library? Or via the List or Library control on a form? Some other way?

Hi @Nikita_Kurguzov
thank you for your reply.
I need even to disable the field FileLeafRef, but I tried your code and with the "hidden" no problem, if I need to "disable" it doesn't work.

Directly in document library with drag and drop, but I want to know if there is a way to disable drandrop and force to use only the form to load a new document.

Thank you.