0

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 Mar 9 '15 at 11:17
  • Yes exactly. I have used Required attribute. but the error message which is getting displayed is not that user friendly. – Vrushabh Jain Mar 9 '15 at 11:31
  • If you edit your question to explain this then we should be able to help out. – BarCotter Mar 9 '15 at 11:54
2

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.

| improve this answer | |
  • 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. – Vrushabh Jain Mar 9 '15 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.