ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 March 30th, 2011, 04:05 AM
kmria kmria is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 2 kmria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 9 sec
Reputation Power: 0
Element USERNAME is undefined in FORM

Hey guys,

I been working on this website where I have a multi level login system. Two pages are login and loginAction. On login page form looks like below.

<cfform method="post" action="login_Action.cfm">
<table align=center class=SingleBorder width="300"> <tr>
<td colspan=2>
<font size=4>Login</font><br>
<img src="design/gifs/green_line.gif" alt="" />
</td>
</tr>
<tr>
<td align=right> Username: </td>
<td align=left> <cfinput class="inputText" type=text name=username size="20">
</td>
</tr>
<tr>
<td align=right> Password: </td>
<td align=left>
<cfinput class="inputText" type=password name=password size="20">
</td>
</tr>
<tr>
<td>
</td>
<td align=left>
<cfif isDefined("form.URLtogo")>
<cfoutput>
<cfinput name=URLtogo type=hidden value=#form.URLtogo#></cfoutput>
<cfinput name=submit class="btn1" type=submit value=Login>
<cfelseif isDefined("URL.URLtogo")>
<cfoutput><cfinput name=URLtogo type=hidden value=#URL.URLtogo#>
</cfoutput>
<cfinput name=submit class="btn1" type=submit value=Login>
</cfif> <br><br>
</td>
</tr>
<tr>
<td bgcolor=e5ae72 align=center colspan=2>
<a href=forgot_Password.cfm> Forgot password?</a><br> Don't have an account?
<a href="signup.cfm?URLtogo=#URLtogo#">Register Now</a>
</td>
</tr>
</table>
</cfform>


and on loginAction page code in between HEAD tag looks like below.

<cfquery name=login datasource="DBS1"> select * from TB_User where Username = '#form.username#' and Password = '#form.password#' </cfquery>


Now every time when I login it throws me this error
Element USERNAME is undefined in FORM
However, if I refresh the page it shows as login was successful.

In cfform name of the text field IS username and it is passing the value too, then why am I getting this error?

thanks for help guys

Reply With Quote
  #2  
Old March 30th, 2011, 09:14 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Try putting quotes around "text" and "username" in your cfinput tag. If that doesn't work, add a <cfdump var="#form#"><cfabort> at the top of your action page to see what is actually in the form scope.

Reply With Quote
  #3  
Old March 30th, 2011, 06:02 PM
kmria kmria is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2011
Posts: 2 kmria User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 9 sec
Reputation Power: 0
Quote:
Originally Posted by kiteless
Try putting quotes around "text" and "username" in your cfinput tag. If that doesn't work, add a <cfdump var="#form#"><cfabort> at the top of your action page to see what is actually in the form scope.


Thanks for your reply. I tried putting quotes without any luck. When I put that CFDUMP line as you said, if showed me table with name of all 4 variables that are passed from login page to Action page and also there values.

Another thing to add, the same code works fine when I test it online. It logs user in and sends user to the page where s/he came from. Just how I wanted it to work. But gives error on local host!!

Reply With Quote
  #4  
Old March 30th, 2011, 10:13 PM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,100 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 4 h 29 m 54 sec
Reputation Power: 966
Not sure then. If it works on production then there must be something going on with your localhost system that is killing the form variables or redirecting you to the action page at some point where the form variables aren't being posted.

You could also add a cfif block at the top of the action page that checks for the form variables, and if they aren't defined, redirect them back to the login page to try and ensure that the form variables are posted.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Element USERNAME is undefined in FORM

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap