Skip to main content
January 25, 2007
Answered

Form Value

  • January 25, 2007
  • 10 replies
  • 606 views
I am having a problem with the following. I created a form and i created a index.cfm. The form takes the users password and login name and the index processes, or invokes it to application.cfc. For some reason when I put the information in and press the submit button, the index.cfm says that the values did not carry over. I put a cfdump at the top of index.cfm and it says that the values carried over, I also put a <cfdump>beyond <cfinvoke component="application" method="verify" returnvariable="UserInfo"> the value is still kept in FORM.USERLOGIN. it isnt lost until i put FORM.USERLOGIN into a arguments varible all hell breaks then. the coding is below!! Debug away!
This topic has been closed for replies.
Correct answer BKBK
It is clear why you get the error. It occurs when your code opens the page index.cfm without the form having been submitted. That can occur, for example, as a result of the following

<!---This is what I added new!--->
<cfif userinfo is false>
<cflocation url="index.cfm"><!--- shouldn't this be login.cfm? --->
</cfif>

<!---basically I said if the data doesnt
match, then go back to login.cfm
--->



addendum: I now see you've noticed it yourself.



10 replies

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
February 4, 2007
It is clear why you get the error. It occurs when your code opens the page index.cfm without the form having been submitted. That can occur, for example, as a result of the following

<!---This is what I added new!--->
<cfif userinfo is false>
<cflocation url="index.cfm"><!--- shouldn't this be login.cfm? --->
</cfif>

<!---basically I said if the data doesnt
match, then go back to login.cfm
--->



addendum: I now see you've noticed it yourself.



BKBK
Community Expert
Community Expert
February 4, 2007
Numerical07, it might help to clear your browser cache. I can assure you that the 3 files I gave you do indeed work together.


February 4, 2007
ok ok here is some crazy stuff. I tried what BKBK told me to do, this is what I did differently. I added a compare() function inside of the application method verify. Once it compares the data from the form with the data from the database, it will return true if it they both equal the same value and false if it doesnt. IT works! BUT!! when I add a <cfif userinfo is false> <cflocation url="index.cfm"></cfif> (which basically means if the two values dont compare, go back to the login screen.................................................. you know what lol. I think i just figured it out. I accidently made the cflocation go back to index.cfm instead of going back to login.cfm. I screwed up. That could of been my problem from the beginning
Inspiring
February 4, 2007
can you post the code from your application.cfc (the one invoked in index.cfm)? some other code there may be interfering with your form scope variables...
February 4, 2007
This is crazy. My Form should be carrying over to the next page. There should not be any excuse on when I hit submit and try to desplay my form data, should my form be undefined. cause i just freakin defined it on the first page.
BKBK
Community Expert
Community Expert
January 26, 2007
Incidentally, I would suggest you do your login code in the onRequestStart method of Application.cfc, by means of the tag cflogin.

January 26, 2007
<cfinvokeargument
name="loginName"
value="#form.userlogin#">

I believe it should be:
<cfinvokeargument
name="userlogin"
value="#form.userlogin#">
Inspiring
January 26, 2007
just wondering if it has anything to do with your component being called "application"? Can application.cfc be invoked like any other component? It is invoked automatically by CF at the start of every request... maybe that's why it does not see you form.userlogin...

just thinking out loud...
January 26, 2007
That is a good point. But I have made a application before that invokes application and gathers the same info as this. only difference is that this application is on another site. almost the same coding.
BKBK
Community Expert
Community Expert
January 26, 2007
Test by changing the name of the action page to index0.cfm. The error may result from the fact that Coldfusion is designed to open the page index.cfm by default.

However, there is something else the matter with your setup. I got the following to work:
BKBK
Community Expert
Community Expert
January 25, 2007
Use <cfform> and </cfform> or else <form> and </form>. Don't mix.

January 26, 2007
Yea it was discussed before. I didnt think I made it clear enough. So i simplified it a little more. Sorry about the <cfform> </form> mis match. that was a typo. In the actual coding they matched. i fixed it. Also I did try
<cfdump var="#form#"><cfabort> it did carry the varibles from the form over to the next page. but for some reason right when it hits the <cfinvoke> thats when i have a issue. I marked where the issue began above :D
January 25, 2007
wasn't this already being discussed under the thread "Form Error"?