I am unable to make input file field required as like standard required in salesforce. I am not using any javascript for this. I have set Required Attribute to True. But the error occurring when I don't select a file is not user friendly. Can anyone help me out for this?

See here for an example of the error message.

  • Can you confirm if you have tried using the required attribute for apex:inputFile? The error message that is displayed to the user when an inputFile is required may not be that friendly
    – BarCotter
    Commented Mar 9, 2015 at 11:17
  • Yes exactly. I have used Required attribute. but the error message which is getting displayed is not that user friendly. Commented Mar 9, 2015 at 11:31
  • If you edit your question to explain this then we should be able to help out.
    – BarCotter
    Commented Mar 9, 2015 at 11:54

1 Answer 1


Use the required attribute - Quoting the official documentation

required - Boolean A Boolean value that specifies whether this inputField is a required field. If set to true, the user must specify a value for this field. If not selected, this value defaults to false. Note that if this input field displays a custom object name its value can be set to nil and will not be required unless you set this attribute to true. The same does not apply to standard object names, which are always required regardless of this attribute.

  • I already have used required Attribute. It is showing me an error if I don't choose any file. Error is " Body: Validation Error: Value is Required". How to deal with error If I don't want it to display. Commented Mar 9, 2015 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .