1

I am using apex:inputsecret with required="true", but this is not working. When I check in Inspect element of Chrome, the required attribute is not shown. If I add required="true" from Inspect element then it works. Can anybody help me in this?

1
  • This may be an issue where SF doesn't put in the required marker or enforce it. Have a look at here to see if it helps
    – BarCotter
    Sep 23, 2014 at 14:56

2 Answers 2

2

Salesforce does not add the required HTML attribute to your fields when setting required="true" on a component.

Setting the component's required attribute indicates that Salesforce should validate that the field is required on the server-side. This differs from the HTML version of the required attribute which does the validation on the client-side.

What you are seeing is the expected behaviour.

If you add an apex:pageMessages component to your page and try and call an action or anything that will submit your form then you should get an error message if your apex:inputSecret is blank.

-3
<input id="theSecretInput" type="password" name="theSecretInput" value="" required=true />

Try the required field as a boolean instead of a string. As suggested by the documentation here : http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_inputSecret.htm

2
  • 4
    required="true" is the correct format. Your code example will produce a "Open quote is expected for attribute "required" associated with an element type "input"" error without the quotes.
    – BarCotter
    Sep 23, 2014 at 14:41
  • yes @BarCotter is right this not work Oct 10, 2014 at 11:59

You must log in to answer this question.

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