1

I have been trying to display placeholder for h:inputSecret but not able to do it. There is no placeholder attribute is exist for h:inputSecret Its a small issue but i didn't find any solution.

Can anyone suggest me a solution?

Teja Maridu
  • 515
  • 1
  • 6
  • 14

1 Answers1

1

I thought everything that was not JSF was passed to the browswer for rendering?

This assumption is thus wrong. Unspecified component attributes are ignored by the JSF renderers.

You have basically the following options to get it to work:

  1. Implement a custom renderer for h:inputText.
  2. Implement a custom component (with a custom renderer).
  3. Implement a JS based solution.
  4. Look for a component library which supports this out the box. PrimeFaces for example has a <p:watermark> for this purpose with nice JS based graceful degradation for browsers which does not support the placeholder attribute on inputs.

StackOverflow same Question

Stack overflow similar question

Community
  • 1
  • 1
chandu
  • 2,276
  • 3
  • 20
  • 35