icon Get the most out of Surmunity, read our tips here! Need an interesting blog to read? You've got to read the Surpass Blog! | Welcome! Please register to access all of our features.
Old October 6th, 2004, 7:37 PM   #1 (permalink)
Surpass Fan
On a golden path...
 
DiscJockey's Avatar
 
Joined in Jul 2004
Hosted on Pass20
422 posts
Gave thanks: 1
Thanked 1 Time in 1 Post
convert from text to password

at the moment i have an ordinary textbox

<input type="text" name="n4" size="20">


i want a button and when they click it it turns the ordinary textbox into a password box


<input type="password" name="n4" size="20">


and this button is gonna be labeled 'hide text'.....
__________________
:P
DiscJockey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 7:53 PM   #2 (permalink)
says LEAVE BRITNEY ALONE!
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,091 posts
Gave thanks: 8
Thanked 34 times
is there a question here? i'm not seeing it. what you just typed out should be what you would do to make a password box, that's why i'm confused
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 8:36 PM   #3 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
I am not very certain that this can be done. The type specification for an input element is something that I don't think is possible to change after the page is loaded.
__________________
Patrick

Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 8:53 PM   #4 (permalink)
says LEAVE BRITNEY ALONE!
Resident.
 
David's Avatar
 
Joined in Mar 2004
Lives in fear of Obama.
Hosted on Pass 7
13,091 posts
Gave thanks: 8
Thanked 34 times
I must not be understanding what you are trying to do. Unless, from what Patrick said, you want to make it load a normal box and turn that into a password box when they click the button? If this is correct, do you mind if I ask why you'd want to do this?
__________________
David is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 10:04 PM   #5 (permalink)
H
after g, before i
Resident.
 
H's Avatar
 
Joined in Jul 2004
Lives in N,BC,CA
8,079 posts
Gave thanks: 48
Thanked 131 times
Quote:
Originally Posted by patrickb
I am not very certain that this can be done. The type specification for an input element is something that I don't think is possible to change after the page is loaded.
Think you could with Javascript.. but I'm not sure how exactly that would react.

Could you possibly expand on what you're trying to accomplish? I'm more than willing to help you out, just need a little more to work with.
H is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 10:13 PM   #6 (permalink)
Surpass Fan
On a golden path...
 
Joined in Jul 2004
372 posts
Gave thanks: 0
Thanked 0 times
there are css scripts which you can use, can't give a link now, but i've seen it done.
__________________
"I am one of the few honest people that I have ever known” ~~Nick, Great Gatsby
---
Don't ever argue with idiots. They drag you down to their level and beat you with experience.
darkzeroman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 10:32 PM   #7 (permalink)
Surpass Fan
Super #1
 
Joined in Aug 2004
Hosted on SH58
1,688 posts
Gave thanks: 6
Thanked 7 times
To my knowledge, that can not be done with CSS.

However, you could put some effort into writing a script. Something like this.

Code:
<input type="text" id="text_input" value="" name="n4" />
<input type="hidden" id="hidden_input" value="" name="n5" />
<input type="button" value="Hide Text" onclick="hide_text" />
and the scripting should go something like this...

Code:
<script type="text/javascript">
function hide_text(){
	var txt = document.getElementById('text_input');
	var txt_value = txt.value;
	var hidden = document.getElementById('hidden_input');
	hidden.value = txt.value;
	txt.value = '******';
	/*Not sure how you would have the asterisks equal the
	length of the input */
}
</script>
I have no idea if it will work or not, as i just wrote it off the top of my head.

Please keep me in the loop if you get this to work out.
__________________
- Evan Charlton | [site] | Server - SH58
Kickersny.com is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 10:44 PM   #8 (permalink)
the one who was
Super #1
 
patrickb's Avatar
 
Joined in Jul 2003
Lives in Memphis
1,967 posts
Gave thanks: 0
Thanked 3 times
I don't think this last solution will work, since all you are basically doing is changing the value of the text field's entry to ***** (however many stars there may be). This will just cause stars to be posted to the form.

If there is a way to do this in javascript, I will find a new exploit. Field types are a very fundamental thing and changing them after they have been set is generally a no-no.

Realistically, I think the original problem is more trouble than it is worth. I can see where changing a password box to a true password box after a user clicked a button, but in reality, whats the point? The only application I see for this is to let the user verify their new password visually, which seems silly at best. If you can't type the password correctly two times in a row, then you don't need it as a password.

Maybe I am offbase here, but seems to me like this an idea designed to skirt the whole purpose of the password field. Masking input is a great thing IMHO.
__________________
Patrick

Warnings: The program(s) might crash unexpectedly or behave otherwise strangely. (But of course, so do many commercial programs on Windows.) --www.gimp.org
patrickb is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old October 6th, 2004, 11:28 PM   #9 (permalink)
Surpass Fan
On a golden path...
 
Joined in Jul 2004
372 posts
Gave thanks: 0
Thanked 0 times
i saying using dhtml for this, isnt it possible? Its kinda like hiding the textbox, then clicking the image to switch it with a password box. I dont know DHTML, but i'm sure things like this are possible.I dont know, maybe i'm wrong....
__________________
"I am one of the few honest people that I have ever known” ~~Nick, Great Gatsby
---
Don't ever argue with idiots. They drag you down to their level and beat you with experience.
darkzeroman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On