I need text inside a textfield FAPI form element to be obscured visually, just like the password field when you type into it.

enter image description here

password FAPI form element does not have proper functionality for what i need, I need textfield functionality but with the ability to hide the input from user.

Is this possible with Drupal 7 FAPI?

  • You could have it as textfield initially then convert the field type using jQuery after load, although I'm not sure if the Form API will care about that or not. But it's easy to check. If you don't care about users who have their JS turned off essentially :)
    – Beebee
    Commented Jun 29, 2016 at 18:15
  • 1
    What is your actual requirement? Be clear in question.
    – Rupesh
    Commented Jun 29, 2016 at 18:27

1 Answer 1


You can add a CSS style to implement this.

However, currently, only Chrome supplies "-webkit-text-security" could do this. I find someone has some sample code: https://jsfiddle.net/estelle/8WpNg/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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