Goal: To create a webpage that will allow the user to edit their user
information. Ok, so from the research I have done... it looks like you cannot
have nested forms so I created 3 CFM pages.
Page 1: "editUserInfoLogin.cfm" (Allows user to login to their account info.)
<body>
<cfform action="editUserInfoUpdate.cfm" method="post">
<label>E-Mail:</label>
<cfinput type="text" name="eMail" value="[EMAIL PROTECTED]" size="50"
maxlength="50" message="Email Required or Email Entered Incorrectly"
validateat="onsubmit" validate="email" required="yes"/>
<br /><label>Password:</label>
<cfinput type="password" name="psswrd" value="abcd" size="12"
maxlength="12" message="Password Required" validateat="onsubmit"
required="yes"/>
<br /><br />
<cfinput type="submit" name="submit" value="Bring Up Account"
validate="submitonce"/>
<br />
<br />
<a href="login.cfm">Go to Login</a>
</cfform>
</body>
Page 2: "editUserInfoUpdate.cfm" (Loads current user information into
appropriate fields so user can edit them) You will notice that inside the
<cfif isDefined("FORM.updateInfo)> that the code that I would like coldfusion
to perform is actually commented out until I can actually get coldfusion to
look inside this action without failing. The only line of code that is not
commented out is <cflocation url="editUserInfoSuccess.cfm"> which is Page 3.
<body>
<cfquery name="qUserPassword" datasource="sonocme">
SELECT primaryKey, password, eMail
FROM C:\CFusionMX7\wwwroot\sonoCME\New\database\CME1.passwords
WHERE password='#FORM.psswrd#' AND eMail='#FORM.eMail#'
</cfquery>
<cfif qUserPassword.RecordCount IS "0">
Your E-Mail and Password do not match any of our records<br />
<a href="editUserInfoLogin.cfm">Go Back</a>
<cfabort>
<cfelse>
<cfquery name="qVerifyActivity" datasource="sonocme">
SELECT eMail, active, fName
FROM C:\CFusionMX7\wwwroot\sonoCME\New\database\CME1.users
WHERE eMail='#FORM.eMail#'
</cfquery>
<cfif qVerifyActivity.RecordCount IS NOT "0">
<cfif #qVerifyActivity.active# IS NOT TRUE>
Your Account is NOT Active<br />
Please Contact the Website Administrator<br />
<a href="editUserInfoLogin.cfm">Go Back</a>
<cfelse>
Thank you <cfoutput>#qVerifyActivity.fName#</cfoutput>, Your
Account is Active<br />
<cfquery name="qUserInfo" datasource="sonocme">
SELECT primaryKey, fName, lName, proID, eMail, zip, SSN
FROM
C:\CFusionMX7\wwwroot\sonoCME\New\database\CME1.users
WHERE eMail='#FORM.eMail#'
</cfquery>
<cfif qUserInfo.RecordCount IS NOT "0">
<cfform name="loadUserInfo" preloader="no" id="insUser">
<cfinput type="hidden"
name="primaryKeyPASSWORD" value='#TRIM(qUserPassword.primaryKey)#'>
<cfinput type="hidden" name="primaryKeyUSER"
value='#TRIM(qUserInfo.primaryKey)#'>
Edit First Name:</label>
<cfinput type="text" name="fNameNEW"
value='#TRIM(qUserInfo.fName)#' size="25" maxlength="25" message="First Name
Required" validateat="onsubmit" required="yes">
<br /><label>Edit Last Name:</label>
<cfinput type="text" name="lNameNEW"
value='#TRIM(qUserInfo.lName)#' size="25" maxlength="25" message="Last Name
Required" validateat="onsubmit" required="yes"/>
<br />
<label>Edit Professional ID
(<em>optional</em>):</label>
<cfinput type="text" name="proIDNEW"
value='#TRIM(qUserInfo.proID)#' size="25" maxlength="25" required="no"/>
<br /><label>Edit E-Mail:</label>
<cfinput type="text" name="eMail1NEW"
value='#TRIM(qUserInfo.eMail)#' size="50" maxlength="50" message="Email
Required or Email Entered Incorrectly" validateat="onsubmit" validate="email"
required="yes"/>
<br />
<label>Edit E-Mail (<em>Enter
Again</em>):</label>
<cfinput type="text" name="eMail2NEW"
value='#TRIM(qUserInfo.eMail)#' size="50" maxlength="50" message="Email
Required or Email Entered Incorrectly" validateat="onsubmit" validate="email"
required="yes"/>
<br /><label>Edit Zip Code:</label>
<cfinput type="text" name="zipNEW"
value='#TRIM(qUserInfo.zip)#' size="5" maxlength="5" message="Zip Code
Required" validateat="onsubmit" validate="zipcode" required="yes"/>
<br /><label>Edit Social Security
Number:</label>
<cfinput type="text" name="ssnNEW"
value='#TRIM(qUserInfo.SSN)#' size="11" maxlength="11" message="Social Security
Number Required or Entered Incorrectly" validateat="onsubmit"
validate="social_security_number" required="yes"/>
<br /><label>Edit Password:</label>
<cfinput type="password" name="psswrd1NEW"
value='#TRIM(qUserPassword.password)#' size="12" maxlength="12"
message="Password Required" validateat="onsubmit" required="yes"/>
<br /><label>Edit Password <em>(Enter
Again)</em>:</label>
<cfinput type="password" name="psswrd2NEW"
value='#TRIM(qUserPassword.password)#' size="12" maxlength="12"
message="Password Required" validateat="onsubmit" required="yes"/>
<br />
<br /><cfinput type="submit" name="updateInfo"
value="Update Account" validate="submitonce"/>
<br />
<br />
<a href="login.cfm">Go Back </a>
</cfform>
<cfif isDefined("FORM.updateInfo")>
<cflocation url="editUserInfoSuccess.cfm">
<!--- <cfif '#FORM.eMail1NEW#' IS NOT
'#FORM.eMail2NEW#'>
E-Mail Addresses do not Match
<cfabort>
<cfelse>
<cfif '#FORM.psswrd1NEW#' IS NOT
'#FORM.psswrd2NEW#'>
Passwords do not Match
<cfabort>
<cfelse>
Shouldn't This work?
<cfquery datasource="sonocme">
UPDATE
C:\CFusionMX7\wwwroot\sonoCME\New\database\CME1.users
SET
fName =
'#FORM.fNameNEW#',
lName =
'#FORM.lNameNEW#',
proID =
'#FORM.proIDNEW#',
eMail =
'#FORM.eMail1NEW#',
zip =
'#FORM.zipNEW#',
SSN =
'#FORM.ssnNEW#'
WHERE primaryKey =
'#FORM.primaryKeyUSER#'
</cfquery>
<cfquery datasource="sonocme">
UPDATE
C:\CFusionMX7\wwwroot\sonoCME\New\database\CME1.passwords
SET
password =
'#FORM.psswrd1NEW#',
eMail =
'#FORM.eMail1NEW#'
WHERE primaryKey =
'#FORM.primaryKeyPASSWORD#'
</cfquery>
</cfif>
</cfif> --->
</cfif>
</cfif>
</cfif>
</cfif>
</cfif>
</body>
Page 3: "editUserInfoSuccess.cfm" (Upon successful update, the user will be
directed here)
<body>
Update Successful
<br /><br />
<a href="login.cfm">Go to Login Page</a>
</body>
I am new to coldfusion and new to this forum... any help would be greatly
appreciated. Thank you!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:1955
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15