Hiding "upload" button in webforms

Category: 

  • Question

Created a form that allows for uploading of pdf files and made the field "private" (which they need to be) but when I select Upload and then try to submit form it gives an error stating that the field is required (which I know). So question is: how do I hide the "upload" button (because I know users can attach and upload files without actually using this button.

These are the css snips I've tried via CSS Injector but so far none are working. I'm using MIT DLC 7.x-2.2.2 as my default theme.

#edit-submitted-data-file-upload-button{
display:none;
visibility:hidden;
}
#edit-image-upload-button{
display:none;
}
#edit-field-name-doc-0-upload-wrapper{
display:none;
}
#edit-field-user-picture-und-0-upload-button{
display:none;
visibility:hidden;
}

PS: Will we ever be able to modify themes or use our own?

6/7/16

Make sure your CSS Injector code is turned on for that page? Your method is correct, but it's difficult to troubleshoot without being able to look at the actual page. If it's public and you're still trying to resolve this issue, can you share the url?

6/20/16

If you scroll down while editing your CSS Injector rule, you'll see a section labeled "Add the CSS on specific pages" that allows you to apply the rule to particular pages. It's applied to the entire site by default, so it probably isn't the reason the CSS is failing if you haven't changed it.

I'm looking at the form at http://physicsrisingstars.mit.edu/candidate-application, and it looks like the upload button CSS will look something like

.webform-component--[field-name] input.form-submit {
display:none
}

(Replace [field-name] with the name of your private upload field.)

Google Chrome has a nice feature for developers where you can right-click on an element and use "Inspect" to see the html, including all the element's classes/ids. It's really helpful for building CSS.

If you need additional help, feel free to contact me directly.

P.S. My guess to the uploading custom themes question is "probably not in the near future" due to the security concerns of allowing users to upload random executable PHP to the server.

6/21/16

Thank you!!! I was able to hide all the upload buttons I needed to!!! :D

6/21/16