-
Notifications
You must be signed in to change notification settings - Fork 14
How to create a password field using the password field function
Added for version: 0.4
Password fields are used on websites to allow the user to input secure data. Password fields work just like text fields, but hide the text entered by the user with stars or dots of some sort. Also, most browsers have special handling to remember passwords for websites.
Conjure allows you to add a password field to your site using the password-field function. The password function can only be used inside forms.
Just like text-field, password-field takes a record, the name of the record, the key in record to get the value from, and optional html-options.
To create a password field for a :user record with key :password use:
(password-field { } :user :password)
Note: You could preset the password by adding the :password key to the map passed into password-field, but in most cases you would not want to do that, so I left it out.
The password input tag created by the call to password-field above is “user[password]”, the id of the input tag is “user-password”.
You can pass html-options to add attributes to the input tag. To set the password field length to 20 use:
(password-field { } :user :password { :size "20" })