Skip navigation
Currently Being Moderated

Help!  Form is not submitting or doing anything! Any ideas?

Jan 18, 2012 8:38 AM

Tags: #forms #coldfusion9 #cf9

I inherited this web application and have zero CF experience and any help is greatly appreciated!  So, the "Forgot Password" form isn't working at all.  The email is sent properly from the referring page and when you click the link it brings up the page right, however, when you fill out the form with "email address" and "username" and hit submit, it does nothing.  I'm not even getting an error.

 

Is there something I'm missing in the code that is wrong?  I'll post the entire code and what the URL looks like when arriving at this page.  It is still in my dev environment.

 

Thanks in advance for ANY help!  I'm really lost and confused.

 

http://<server>/~mld/ForgotPassword/index.cfm?plw=359&qke=995708

 

<!---

Project: MLD Registry

Page Name: index.cfm

Page Purpose: Home page for Forgot Password pages

Programmer: Eric Savage

--->

 

 

<html>

<head>

          <title>Forgot Password</title>

          <link rel="stylesheet" type="text/css" media="screen" href="../StyleSheet_Display.css" />

          <link rel="stylesheet" type="text/css" media="print" href="../StyleSheet_Print.css" />

</head>

 

 

<body>

<cfsilent>

<cfparam name="plw" default=""><!--- Registry_ID --->

<cfparam name="qke" default=""><!--- Acct_num_temp --->

<cfparam name="Email" default="">

<cfparam name="UserName" default=""><!--- User Name --->

<cfparam name="CheckEntries" default=""><!--- Check submissions for errors --->

<cfparam name="Error" default="0">

<cfparam name="ErrorMessage_Email" default="">

<cfparam name="ErrorMessage_UserName" default="">

<cfparam name="ksr" default=""><!--- Forgot password: email/new password sent --->

<cfparam name="uca" default="">

 

 

<cfif Len(CheckEntries) and Len(UserName) and Len(Email) and Len(plw) and Len(qke)>

          <cftry>

    <cfquery name="CheckIfValidUser" datasource="#Datasource#">

        SELECT                    rid,rid_name,r_email,registry_id,acct_num_temp,r_website_ty pe

        FROM                    registry

        WHERE                    rid_name= <cfqueryparam value="#UserName#" cfsqltype="CF_SQL_VARCHAR"> and r_email= <cfqueryparam value="#Email#" cfsqltype="CF_SQL_VARCHAR"> and registry_id= #plw# and acct_num_temp= #qke#

    </cfquery>

    <cfcatch type="Any">

                    <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

              <cflocation url="ErrorMessage.cfm" addtoken="No">

        <cfabort>

    </cfcatch>

          </cftry>

 

 

          <cfif not CheckIfValidUser.RecordCount>

                    <cftry>

                    <cfquery name="UserLog" datasource="#Datasource#">

                              INSERT INTO userlog(http_user_agent,todaysdate,ip_address,user_name,comments)

                              VALUES ('#CGI.http_user_agent#',#CreateODBCDateTime(Now())#,'#remote_addr#', '#Email#','ForgotPassword/index.cfm: failed attempt')

                    </cfquery>

                    <cfcatch type="Any">

                              <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

                    </cfcatch>

                    </cftry>

          </cfif>

 

 

          <cfif CheckIfValidUser.RecordCount>

                    <cfinclude template="../includefiles/inc_Password_CreateRandom.cfm"><!--- Creates random password in variable called RandomlyCreated_Password --->

       

        <cfset Password_To_Check= RandomlyCreated_Password><!--- Pass value of new password to include file --->

                    <cfinclude template="../includefiles/inc_Password_CheckFormat.cfm"><!--- Check password complies with  --->

                    <cfif Len(ErrorMessage_Password_To_Check)>

                  <cfset ErrorMessage= "(" & #CheckIfValidUser.rid# & ") [auto password gen] " &  ErrorMessage_Password_To_Check>

            <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

            <cflocation url="ErrorMessage.cfm" addtoken="No">

            <cfabort>

                    </cfif>

       

                    <cfif not Len(ErrorMessage_Password_To_Check)>

            <cftry>

            <cfquery name="UpdatePassword" datasource="#Datasource#">

                UPDATE                    registry

                SET                              rid_pass= Password('#RandomlyCreated_Password#')

                WHERE                    rid_name= <cfqueryparam value="#UserName#" cfsqltype="CF_SQL_VARCHAR"> and r_email= <cfqueryparam value="#Email#" cfsqltype="CF_SQL_VARCHAR"> and registry_id= #plw# and acct_num_temp= #qke#

            </cfquery>

            <cfcatch type="Any">

                <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

                <cflocation url="ErrorMessage.cfm" addtoken="No">

                <cfabort>

            </cfcatch>

            </cftry>

 

 

            <cftry>

            <cfquery name="UserLog" datasource="#Datasource#">

                INSERT INTO userlog(http_user_agent,todaysdate,ip_address,user,comments)

                VALUES ('#CGI.http_user_agent#',#CreateODBCDateTime(Now())#,'#remote_addr#', '#CheckIfValidUser.rid#','ForgotPassword/index.cfm: new password added')

            </cfquery>

            <cfcatch type="Any">

                <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

            </cfcatch>

            </cftry>

 

 

            <cfparam name="Subject" default="(Secure) NDRD Clinical Questionnaire">

            <cfif CheckIfValidUser.r_website_type is "MLD"><cfset Subject= "(Secure) MLD Registry"></cfif>

            <cfif CheckIfValidUser.r_website_type is "NFRD"><cfset Subject= "(Secure) NFRD Registry for Rare Genetic Disorders"></cfif>

            <cftry>

            <cfmail

                to="#Email#"

                subject="#Subject#"

                from="#CONTACT.EMAIL_NURSE#"

                server="<SMTP SERVER>"

                type="html">

                <p>Here is the new password you requested: #RandomlyCreated_Password#.</p>

            </cfmail>

            <cfcatch type="Any">

                <cfinclude template="../includefiles/inc_EmailWebsiteManager.cfm">

                <cflocation url="ErrorMessage.cfm" addtoken="No">

                <cfabort>

            </cfcatch>

            </cftry>

           

            <cfparam name="WebsiteType" default="">

            <cfif CheckIfValidUser.r_website_type is "Clinic"><cfset WebsiteType= "01345"></cfif>

            <cfif CheckIfValidUser.r_website_type is "MLD"><cfset WebsiteType= "04385"></cfif>

            <cfif CheckIfValidUser.r_website_type is "NFRD"><cfset WebsiteType= "03475"></cfif>

   

            <cflocation url="index.cfm?ksr=30471&dfa=84836&uca=#WebsiteType#" addtoken="No">

        </cfif>

          </cfif>

</cfif>

</cfsilent>

 

 

<cfinclude template="inc_PageTitle.cfm"><!--- Page title --->

<div id="Container">

          <cfinclude template="inc_NavBar.cfm">

          <div id="Content">

                    <div id="minheight">

                              <cfoutput>

                              <cfif not Len(ksr)>

                                        <div style="padding: .5em 0 .75em 0; border-style: solid; border-width: 0 0 1px 0;">

                    Please enter your email address and user name.

                                        </div>

                                        <cfform action="index.cfm" method="POST">

                                                  <p>

                                                  <span class="ResponseLabel_10"><label for="Email">Email Address</label></span>

                                                  <cfinput type="Text" name="Email" id="Email" value="#Email#" message="Please enter an email address" required="Yes" size="30" maxlength="40">

                                                  </p>

                                                  <p>

                                                  <span class="ResponseLabel_10">User Name</span>

                                                  <cfinput type="Text" name="UserName" id="UserName" value="#UserName#" message="Please enter a User Name" required="Yes" size="12" maxlength="50">

                                                  </p>

                                                  <p><input type="submit" value="Submit"></p>

                                                  <input type="hidden" name="CheckEntries" value="Check">

                    <cfoutput>

                                                  <input type="hidden" name="plw" value="#plw#"><!--- Registry_ID --->

                                                   <input type="hidden" name="qke" value="#qke#"><!--- Acct_num_temp --->

                    </cfoutput>

                                        </cfform>

                              </cfif>

                              <cfif Len(ksr)>

                                        <cfif Trim(uca) is "01345"><cfset WebsiteType= "Clinic"></cfif>

                <cfif Trim(uca) is "04385"><cfset WebsiteType= "MLD"></cfif>

                <cfif Trim(uca) is "03475"><cfset WebsiteType= "NFRD"></cfif>

                                        <div style="padding: .5em 0 .75em 0;">An email has been sent with your new password.</div>

               

                <cfif Len(Trim(WebsiteType))><a href="#HTMLPath#/#WebsiteType#/LogIn.cfm">Log in</a></cfif>

                              </cfif>

                              </cfoutput>

                    </div><!--- min-height --->

          </div><!--- Content --->

</div><!--- Containter --->

<cfinclude template="../includefiles/inc_PageFooter.cfm"><!--- Page footer (contains closing tag for Container) --->


 
Replies
  • Currently Being Moderated
    Jan 18, 2012 8:57 AM   in reply to jeffsmth

    <cfform action="index.cfm" method="POST">

     

    This line is going to tell the web browser to submitt the page to the web server and have the web server run the "index.cfm" page.

     

    The web server then expects the "index.cfm" page to expect a post request and do something with the key-value pairs contained in the header of the request.

     

    With a rather generaic file name like "index.cfm" it is not unlikely that the index.cfm page simply ignores the form key-value pairs and does nothing with them.  But with no way to see the server side code of this index.cfm page I can not tell for sure.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 18, 2012 9:16 AM   in reply to jeffsmth

    THen the place to start is to put <cfdump var="#form#"> at the top of the page and run through the process and make sure you are getting expected results.

     

    From there, work through the process one step at a time until you find out where your are not getting the expected results and hopefully WHY you are not getting the expected results.

     

    The places to check first are the form values and then the query resutls generated using the form values.

     

    Let us know if you need more explict help.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points