Hide browse button and field in upload

Is it possible to hide the browse button and upload field as well as the delete checkbox and label? Even if I set disabled on insert/update you can still browse and upload a record. For the standard user, this can cause problems replacing uploads and such. I want to be able to display the link of the upload exactly like it is in a grid. I don’t understand why it isn’t this way already. If it works in a grid why can it not be the same in a form?

WHat do you want to achieve. Just a downloadfield in a form? Then go to the edit fields and set the readonly flag.

It is a field of type Document (Database). If I make it read only in the edit fields section then it doesn’t show up in the form at all. It is in a block by itself. The block is still there but no field inside, it still has the field label though. I just want to click a link of the file name like in a grid to download without the browse button and field.

I figured out how to block insertion of new file. I just set the allowed extensions to .abc. I found a post on hiding the delete checkbox -> Click. I can’t quite seem to find the proper classes or ids in the code and all I get is a blank form when ran. I tried events and the javascript section with no luck. I need more instructions from that post.

With the code form the post linked above, I have it working somewhat. I’m using it to try to hide the input box but It hides all input boxes. The input box has ids not classes, or I can;t find what is what. I’m using the source explorer in firefox. Is there a different sure fire way to get the proper class names?

It’s a reasonable requirement and I need to do this too.

For example, the admin upload and save the records, and when the other users open the records, I will hide the “delete” “update” button of the form, and also want to hide the “select file”, “upload file” and the checkbox for the current user. When the admin login and open the records, it can show up.

How to do that? (of course it cannot be saved when the delete, update button is hide. But a system should not give the user to select files since he cannot save it to database.)

In Firefox, right click on the object and select “Inspect Element”

Also, check out this link for more info (i.e. turning off by ID instead of class).

Dave

Here we are, 5 years later…and
I see the select file button is still showed even when the field is set read only
didn’t SC fix this unclear behaviour yet?

thanks in advance

Hi
Has anyone hid the select file button?

Thank you.

This is how I do to resolve this problem.

Let say I have a field of type Document (File Name) called {sc_attachment}, then I add a New Label Field called {attachment}. I only allow admin privilege to upload or delete the file, others can only view the file.

if ([usr_priv_admin]) { // if admin, hide {attachment} field
sc_field_display({attachment}, off);
} else { // if not admin, hide {sc_attachment} field and create the link to file
sc_field_display({sc_attachment}, off);
{attachment} = “”.{sc_attachment}."";
}

thanks
but with this the file name is displayed, but the user cannot download it, can he?

Yes, user can download the file. The else statement is supposed to be <a href> whereby user can click the URL link and download the file. When I pasted this statement, it is not showing in the posted message.

{attachment}="<a href=’".$Path_to_your_file.htmlentities({sc_attachment}, ENT_QUOTES)."’>".{sc_attachment}."</a>";

1 Like