[SalesForce] How to make a inputFile field required

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.

Best Answer

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.

Related Topic