ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 14th, 2004, 11:55 AM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Clear password textbox on Submit

I have an intranet page with a link to a coldfusion project log. When one clicks on the link the first cfm page is a login page. When the user hits the submit button the first page of the project log opens in a new window (and hence, subsequent pages of the project log).

The problem is that the password remains behind in the parent window. Is there any code I can include that says clear the text field when the user hits the submit button?

Thanks from a newb,
melissa

Reply With Quote
  #2  
Old October 14th, 2004, 12:34 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
All hail JavaScript!
Code:
<script language="JavaScript" type="text/javascript">
function iLikePudding() {
document.yourForm.submit();
document.yourForm.password.value = '';
}
</script>
</head>
<body>
<form name="yourForm" method="post" action="" target="_blank">
<input type="password" name="password">
<input type="button" value="Fake Submit" onclick="iLikePudding();">
</form>

That should work, since it submits the form before resetting the field. Try it out.

Reply With Quote
  #3  
Old October 14th, 2004, 12:51 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Oh how I wish I knew JavaScript!

Unfortunately it didn't work . . .

Here is what I have:

Code:
<script language="JavaScript" type="text/javascript">
	function AutoClearLogin() {
	document.loginform.submit();
	document.loginform.password.value = '';
	}
	</script>
    <cfif #session.login# is "WrongPassword">
      Password entered incorrectly. Please try again.
    </cfif>
    <form name="loginform" action="validatepassword.cfm" method="post" target="_blank">
    <p><font size="+1">To query and view projects simply click on the Submit button (no password required).<br>
	<font color="#FF0000">To modify or add a project, please enter a password and click on the Submit button.</font></p>
    <p>Click the submit button to continue.</p>
    <input type="password" name="pwd" size=25 maxlength=25>&nbsp;
    <input type="button" value="Submit" onClick="AutoClearLogin();">
    </form>


I'm hoping its my lack of knowledge of JavaScript that keeps me from seeing the stupid error I have undoubtedly made?

Thanks for helping me out -
melissa

Reply With Quote
  #4  
Old October 14th, 2004, 01:13 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
You're calling your password field 'pwd' and not 'password'.
So you need to change this:
document.loginform.password.value = '';

to this:
document.loginform.pwd.value = '';

Hope that helps.

Reply With Quote
  #5  
Old October 14th, 2004, 01:17 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Actually I had tried that too before but forgot to change it back when I pasted the code in that last post. Still doesn't work. I'm wondering if it has anything to do with the fact that I have the action set to go to a validatelogin.cfm page?

Thanks again for your help,
melissa

Reply With Quote
  #6  
Old October 14th, 2004, 01:29 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,689 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 16 h 33 m 51 sec
Reputation Power: 53
Also keep in mind that if anyone has Javascript turned off this won't work. Is there any reason why you are opening a new window and not just loading the next page into the same window?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #7  
Old October 14th, 2004, 01:46 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Yes. The intranet pages are all developed from a template built in Dreamweaver. On the intranet pages are logos, big titles and huge buttons that take up a lot of real estate. These are all necessary to our organization apparently.

The project log is designed only for a smal group of people so they don't really need access to all that stuff once inside the project log. The project log itself contains a few very large table that need all the real estate they can get, hence opening a seperate page.

Is there another way to clear the textbox without using JS?

thanks,
melissa

Reply With Quote
  #8  
Old October 14th, 2004, 02:24 PM
bocmaxima's Avatar
bocmaxima bocmaxima is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2004
Location: Tucson, Sonora
Posts: 1,322 bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level)bocmaxima User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 17 h 46 m 5 sec
Reputation Power: 23
Send a message via AIM to bocmaxima
Quote:
Originally Posted by mkm
Is there another way to clear the textbox without using JS?

Yes, but what's the syntax in the JavaScript errors you're getting?

Also, try changing your script to this:
Code:
function validateForm() {
document.formName.pwd.value = '';
}

And changing your form to this:
<form onsubmit="validateForm();">

And putting your submit button back on:
<input type="submit" value="Submit">

If you still get errors or the password doesn't get sent, you can have a hidden field populated with the password when the form submits and the visible one go blank.
Hope that helps.

Reply With Quote
  #9  
Old October 14th, 2004, 04:29 PM
mkm mkm is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 104 mkm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 51 m 53 sec
Reputation Power: 5
Okay I'm really dumb. Chalk it up to bad habits.

First off, I needed to set a value field to "" in the password paramater so that it looked like this:

Code:
<input type="password" value="" name="pwd">


Second, the reason it wasn't working was because of the onClick. See, I'm a lazy computer user - I almost never use the mouse if I don't have to. I almost always use the Tab key to get around, alt key for menus, ctrl key for known and common functions, and the Enter key for buttons. So the onClick function never fired because I was never using the mouse to click on the submit button. Pretty silly huh? Where is the smiley smacking itself in the forehead? That is one I would use a lot.

So I have a friend helping me to write some code to capture hitting the Enter key to submit the form as well as using the mouse to click on the submit button.

Thanks all for your help - sorry to be such a noob!

cheers,
melissa

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Clear password textbox on Submit


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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 not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT