Welcome Guest, Not a member yet? Register   Sign In
Using form_password default values

Hello CI community,

I am coding my first CI page and am trying to utilize the form_password helper. My goal is to have default values displayed in inputs like Email and Password without having to put text next to the input box.

I have two problems:

1. How do I get the form_input fields to revert to default value of say Email if a user deletes this value and focuses another box.

2. When using form_password the default value is hidden text, how can I show the value of say Password.

Thanks for any help!

If you don't want the characters in the password field hidden, use a text type. The purpose of the password field IS to hide the characters so people possibly looking over your shoulder can't see it on the screen. You can't change that behavior.

I do want the behavior for when someone is typing of course but is there any way to display the default value any different?

Edit** I have a feeling this is going to require Javascript. I also do not want the default behavior of having someone delete the default value either.

Sorry for the noob question I usually just have text accompanying the box but wanted to try something different like Twitter uses(they obviously have much JS going on).

Thank you for helping out!

Yes, using javascript you can start with a text input with a plain text default value showing and when they start typing change it to a password input. But there's no way to get plain text to show up in a password input.

I forgot about the placeholder option in HTML5, but it will obviously only work in browsers that implement it.

Perfect, thank you for the help. I will look into utilizing that Javascript for sure and maybe play around with the HTML5. The site isn't going live, it is a class project so it could be a good opportunity to use it.

Theme © iAndrew 2016 - Forum software by © MyBB