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

[eluser]Randallsm83[/eluser]
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!
#2

[eluser]CroNiX[/eluser]
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.
#3

[eluser]Randallsm83[/eluser]
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!
#4

[eluser]CroNiX[/eluser]
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.
#5

[eluser]CroNiX[/eluser]
I forgot about the placeholder option in HTML5, but it will obviously only work in browsers that implement it.
#6

[eluser]Randallsm83[/eluser]
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