Solved

form confirmation problem

Posted on 2015-01-24
50
78 Views
Last Modified: 2015-02-11
ColdFusion 11
MS SQL Server 2012

Short version: A user submits a conference registration form, but realizes she made an error. She pages back in her web browser, enters corrected information, submits the form again, and gets an error -- "That email address is already in use."

Details: To prevent multiple registrations for the same email address, I use this code in the conference registration form:

 <!--- in this query select NOTHING from table #request.RegisterTable#, and simply check if x_email exists --->
 
 <cfquery datasource="#APPLICATION.dataSource#" name="CheckUserEmail">
  SELECT 'Nothing' FROM #request.RegisterTable#
  WHERE x_email = <CFQUERYPARAM CFSQLTYPE="cf_sql_varchar" VALUE="#form.x_email#">
  AND  RegisterID <> <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">

  </cfquery>

  
   <!--- if x_email exists, display error; refuse record insert --->
   
	<cfif CheckUserEmail.recordcount GT 0>
		   <cfthrow message="That email address is already in use. Did you already register for the NNVAWI conference? Please contact NNVAWI at info@nnvawi.org.">
           
	</cfif>

Open in new window


This has worked fine until some users began to page back and make corrections. So, instead, I need to do the registration steps in this order:

1) get the user to review her entered information
2) give user a chance to go back and make corrections
3) commit the form data to the database
4) send the user to the payment gateway page

Is there a way that I can get the user to review her entered data before that data is committed to the database?

Thank you as always for your help.

Eric
0
Comment
Question by:Eric Bourland
  • 32
  • 15
  • 2
  • +1
50 Comments
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
Hi Eric,
I am not sure your solution will fix the problem.  It's a frequent web problem, we NEVER want the user to have to hit the back button.   If your user submits their entry and even if they are sitting on a review page, they may still choose to click the back button.   There's not much you can do about that.

There may be a couple ways to do this.   Perhaps the easiest way is to put a big fat edit button on the page after the submit so the user will click that to modify her submission rather than click the back button.

So, after submit, you could show the information on the screen and include an Edit button in case they want to make changes, otherwise, they can fill out the next part of the form, or just a have a big "Continue" button if you need to pass them through to the gateway.

I guess what I am saying is, don't try to prevent the information from going to the database, just let it save and then give them the option to go on or edit.  If they Edit, then you have the primary key field so you know to do an update instead of an insert.
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
gdemaria,

Good to hear from you.

I like the Big Fat Edit Button solution.

>>>So, after submit, you could show the information on the screen and include an Edit button in case they want to make changes, otherwise, they can fill out the next part of the form, or just a have a big "Continue" button if you need to pass them through to the gateway.

I like this idea. I am going to discuss this with the client first, and suggest your idea. I'll say "gdemaria said Do This." ;-)

I'll go talk to the client then I'll return here. Thanks as always. Hope your weekend is going well.

Eric
0
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 39 total points
Comment Utility
>> "gdemaria said Do This."

GD - you should print up some T-Shirts made with that tag line ;-)
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
LOL.

I'm working on the edit page. I'm taking care to sanitize the form fields. I might ask you all about that. This will be an edit page that is, essentially, open to the public -- which of course makes me a little wary.

The edit page will be able only to make edits to an existing record. I did make a big green Edit button that I hope people will heed. =)

I'll have another update soon.

Hope your weekend is going very well.

Eric
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
> GD - you should print up some T-Shirts made with that tag line ;-)

Love it !   How's this.. (see attached)
t-shirt.png
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I am almost ready to send this to my client. Or show up wearing the  t-shirt. I've been cackling about this for ten minutes.

=)

I am making progress on this task but am baffled by something.

For security reasons, I want to hide the RegisterID -- I would like url.RegisterID to not be available to prying eyes. I am running into an error.

In the register form confirmation page I have this:

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm">Edit Registration</a>
</div>

Open in new window


Template HideEdit.cfm is simply:

<cfinclude template="/editRegistrants.cfm?RegisterID=#val(RegisterID)#">

Open in new window


When I view HideEdit.cfm I get a server 500 error which means there is something here that ColdFusion does not like.

Complication: ever since I upgraded to CF11 I am not able to see Exception Information or Debugging Output. Even when those options are enabled in CF Administrator. The host -- viviotech.net -- is not sure why this is the case. In any case I am able to see there is server 500 error, but I am not able to see details.

My guess is this:

?RegisterID=#val(RegisterID)#

I have not put variable RegisterID in a scope, so ColdFusion does not know where to find a value for RegisterID.

What am I missing?

Thanks friends. =)

Eric

HideEdit.cfm:

<cfinclude template="/editRegistrants.cfm?RegisterID=#val(RegisterID)#">

Open in new window



editRegistrants.cfm:

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: add, update x_company members
Created: 20140701
Revised: 20150125
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">

<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

<!--- a RegisterID does exists; the action is UPDATE --->

<!--- query UpdateUser updates a page record in content table --->
            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">

           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>
     

<!--- when finished? relocate --->

<cflocation url="/confirmationPage.cfm?RegisterID=#val(url.RegisterID)#">

             
<!--- END: Save action --->

<!--- END form.doSave --->
                    </cfif>
       
 

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/manage/user_header.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type=button value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">

Open in new window

0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
Unless something has changed in CF 11, you cannot include a query string parameter when doing a CFINCLUDE...
<cfinclude template="/editRegistrants.cfm?RegisterID=#val(RegisterID)#">

This should be...
<cfinclude template="/editRegistrants.cfm">

Unless you meant to change the page with CFLOCATION?
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
>>>Unless something has changed in CF 11, you cannot include a query string parameter when doing a CFINCLUDE...

Got it. Makes sense. That was a piece of the puzzle.

I think I am making progress on this. I worked on this last night some more.

I'm going to try a few things and come back here with results. More soon.

Hope the "historic" snowstorm is not disrupting your work day or history. =)
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
>> How's this.. (see attached)

Haha! I want one. You should put "Eric agrees" on the back :-)
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I downloaded the t-shirt. Have been consistently cracking up about it. I do agree.

Making progress on this problem -- more soon. E
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
OK, here is where I am:

HideEdit.cfm is now just:

<cfinclude template="/editRegistrants.cfm">

Open in new window


The confirmation page -- Confirmation.cfm -- has a big green button like this:

<a class="button green" href="/HideEdit.cfm">Edit Registration</a>

Open in new window


My problem is -- how do I tell editRegistrants.cfm which record to edit, if I cannot include the record in the <cfinclude> template?

Would I use CFLOCATION? Ummm.... what might that look like?

Thank you again. =)

Eric
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
Looks like this is taking you to your registration page?    This is where you would put your query string referencing the ID to edit...

<a class="button green" href="/HideEdit.cfm">Edit Registration</a>

<a class="button green" href="/HideEdit.cfm?RegisterID=#val(RegisterID)#">Edit Registration</a>
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Got it. Hmm... I tried that. Here's what happens:

User fills in, submits register form. Sees confirmation page which repeats submitted information.

Confirmation page has this link:

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(RegisterID)#">Edit Registration</a> 
</div>

Open in new window


But now, HideEdit.cfm shows me this page: http://nnvawi.org/HideEdit.cfm?RegisterID=0

And all of the form fields are empty.

It looks like the RegisterID is not coming through in scope URL.

Do you think that, in this:

<a class="button green" href="/HideEdit.cfm?RegisterID=#val(RegisterID)#">Edit Registration</a> 

Open in new window


... do I need to set a scope for the variable RegisterID?

Maybe use a new query to request the value of the RegisterID?
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
maybe this?

     <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>
    

Open in new window

0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
(Apologies for scattered updates.)

Update -- I think this query works.

   <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>

Open in new window


I am now able to see the Edit Registration page without an error.

Now, I need to process the Edit Registration form, then return to the Confirmation page. In Edit Registration, I use cflocation to do this; here is the whole query:

<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

<!--- the action is UPDATE --->

<!--- query UpdateUser updates a page record in content table --->
            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">

           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>
     

<!--- when finished? relocate --->

<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#">



             
<!--- END: Save action --->

<!--- END form.doSave --->
                    </cfif>

Open in new window


... but the confirmation form gives me a server 500 error again, with no debugging output.

I'm missing something somewhere. I will keep looking at this. =) Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I need to make the Confirmation page into my Edit Registration page. The Confirmation page already has the database update and insert queries in place. No need to state those queries again on a separate Edit Registration page. This will simplify things. I am working on this. I'll send another update later -- probably tomorrow morning. Thank you again. Hope you all are safe from the big snowstorm. Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Update: making progress on this. The application makes much more sense to me now.

I will use register.cfm to insert the initial registration record into the database table.

I will use confirmation.cfm as an Edit Form page that allows the registrant to view and edit her details, and also contains (as hidden fields) the payment gateway fingerprint details.

I'm nearly done with this and will send an update later this evening, or tomorrow morning.

Just didn't want to leave this question hanging. More ASAP. Hope you all are great. E
0
 
LVL 15

Expert Comment

by:myselfrandhawa
Comment Utility
You already have experts advice here.

Just an Update: If you so concerned about the user's back and forth issues, just create you multiple page registration as 3 step process like wizard and and the end, just submit the form values to database.

So store all values in session and at the last page, move them to database and immediately after that do a cflocation to another page and clear all session scope values related to that form.

This way you tricked them to never create issues with the back and forth, even it they try, the sessions you will handling will get overwritten.

Just an another side approach

Cheers :)
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Dear randhawa,

That sounds like a very good idea, in fact.

I've been struggling with this for a few days; the client is getting impatient. gdemaria and _agx_ have given me generous, kindhearted, expert advice as always but I have not quite gotten this to work, due to my own distraction, I suppose. I have understood and fixed a number of problems along the way. Right now I am getting a mysterious error not from ColdFusion but from the payment gateway, authorize.net,.

I'll figure it out. =) Storing the form values as session variables -- I will take a look at that, Thank you very much.

Hope you're great today, I'll post another update soon. =)

Eric
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
That is one alternative and may be good for some situations.   I don't use session variables to that extent however, I would rather store information in the database and set status flags.   One big reason is that shopping carts that disappear drive me crazy!   When I shop and put items in the cart then take a phone call or answer the door or something, come back and all my items are gone because of a "time-out"  that is really frustrating; not a good user experience.

Anyone, just my 2 cents.  Eric let us know if you need more help
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Friends, thank you for all of this input.

I've been reading up on session variables: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7c48.html

I think I understand the concept. I think I would like to try this. These conference registrants page back and forth quite a lot. I can set the timeout for 60 minutes and, if they leave their computers for longer than that, they will just need to start over. gdemaria -- I hear you. It is vexing when you gotta leave for a little while to take care of something, and you come back and your stuff is gone.

So, I think need to begin by setting up session management in application.cfc -- right? I can add something like:

<cfapplication name="Register"  
    sessionmanagement="Yes" 
    sessiontimeout=#CreateTimeSpan(0,0,60,0)#>

Open in new window


So, the beginning of application.cfc looks like:

<cfcomponent output="false">

  <!--- Name the application. --->
  <cfset this.name="NNVAWI">
  
  <cfset this.applicationTimeout = CreateTimeSpan(0,0,360,0)>
  
  <!--- Turn on session management. --->
  <cfset this.sessionManagement="true">
  
  <!--- Set session timeout period --->
  <cfset this.sessionTimeout = CreateTimeSpan(0,0,360,0)>

  <cfset this.clientManagement = "false">

<!--- set up application Register --->
<cfapplication name="Register"  
    sessionmanagement="Yes" 
    sessiontimeout=#CreateTimeSpan(0,0,60,0)#>

....

Open in new window


Am I on the right track? Thanks as always. Eric
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
you never had session variables turned on?   Isn't that the way you manage a login?

I am going to advice you against this again, this time not because of the time-out and having to start over, but because of the added work you are about to undertake.   If you do this, then when the person submits the form you will have to save all the values into session variables, then load the session variables back into form input tags for display, then when they submit again save them into the database, then clear the session variables.

The alternative is so much easier.   Use the form you already have, submit to save into the database, then show the same form again or a text-only page (no editing).   If the user wants to modify it, they click edit and go back to the first form.  Very easy.
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
>>>The alternative is so much easier.   Use the form you already have, submit to save into the database, then show the same form again or a text-only page (no editing).   If the user wants to modify it, they click edit and go back to the first form.  Very easy.

This is a persuasive argument. I was not aware of what I was getting into.

I've got the edit form completed but am having a couple of weird problems with it. I'll run it by you. Let me gather my thoughts. =) Thank you, gdemaria. More soon. E
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
> I've got the edit form completed but am having a couple of weird problems with it

Well, you need the edit form either way, so we need to get that running.
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I agree.

I think I'd better explain what I have done so far.

1) User registers for conference with simple form: http://nnvawi.org/Register2015New.cfm

This form creates the record in the data table. It works fine.

2) User sees her information on the confirmation page, for example:

http://nnvawi.org/confirmationPageNew.cfm;jsessionid=1941A48693AA6F210B9F200E62AF99E2.cfusion?RegisterID=3213&CFID=449682&CFTOKEN=3973e1f1ce7e3d80-28F62820-E074-4B95-F26AB2782DD2F3A3)

3) Confirmation page, http://nnvawi.org/confirmationPageNew.cfm, does two things:

a) provide edit form where user can edit her information
b) when edit form is submitted, record is updated, and also the information is submitted to payment gateway

However, the edit form on the confirmation page currently does neither. The form does not update the record; the payment gateway also throws an error that says: "(13) The merchant login ID or password is invalid or the account is inactive." ... but I know this is not true because the production confirmation page uses the same loginID and password.

I am currently looking at the confirmation page. It is weird that the update does not even work; that should happen even before anything is submitted to the gateway.

I wonder if the problem is, I am trying to get the form to do these two things at the same time:

1) update record
2) send information to authorize.net gateway

The FORM action is this:

<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm" action="https://secure.authorize.net/gateway/transact.dll">

Open in new window


.... and this just submits the data to authorize.net. I have a feeling I need to do something else to update the data in the database table.

Am I on the right track?

Thank you as always. =)

Eric
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Good morning. Sorry that I was away for several days. I've been looking further at this question.

I think my chief problem at the moment is, I am trying to get this edit FORM action to achieve two tasks at the same time:

1) update the database table with new information
2) also, transmit the updated data, plus payment gateway "fingerprint information", to the payment gateway which is authorize.net

I don't think the edit FORM can do both actions at the same time. I'd love to be proved wrong.

So, the solution seems to be -- make a separate edit FORM -- as gdemaria suggested in the first place:

http://www.experts-exchange.com/Programming/Languages/Scripting/Cold_Fusion_Markup_Language/Q_28603217.html#a40568426

I found that when I created the edit FORM, that I was able to direct the user to the edit FORM to edit the correct record, but I was not able to return the user to the Confirmation form and still display the (now updated) record.

I hope that makes sense.

I'm going to work on creating the separate edit FORM, and then I will probably ask advice about:

1) editing the record in a secure way
2) returning the user to the registration confirmation form that displays the correct registration record

I'm working on this now. Thanks again for your patience and advice.

Eric
0
 
LVL 39

Expert Comment

by:gdemaria
Comment Utility
Eric would you like to attach your files so we can take a look?
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I sure will. =) I guess I felt I should get everything in order before I dropped three different, long files here. OK, here goes.

The register form

<!-----
Name:        Register2015.cfm
Author:      EB / _agx_ / gdemaria
Description: first step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">


<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- begin form.doSave --->

<cfif IsDefined("FORM.doSave")>

<!--- query to insert new record into registration table --->
			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
                        )
                        
                        
			     VALUES(
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>

              
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>


       <!--- done? relocate --->

<cflocation url="/confirmationPageNew.cfm?RegisterID=#val(form.RegisterID)#" addtoken="yes">
       

<!--- END form.doSave --->
                    </cfif>
        
<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>



       <cfoutput>
<cfinclude template="/SiteHeader.cfm">


<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">

 

  <ul>
        <li>
<legend><h2>Conference Registration</h2></legend>
      </li>
      

<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="" maxlength="255" tabindex="1" size="70" autofocus="true" />
               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
        
             
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
         
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>


<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    

  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         
           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li>  
           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  
           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     

           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>     



           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     
<li>
  <label for="x_email"><h3>Email Address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter email address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate email address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="" maxlength="128" tabindex="17" size="70" />
              
</li>                   
      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="" maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>


<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM #REQUEST.conferenceFeeTable#
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td><strong>#getConferenceTypes.ConferenceFeeTitle#</strong></td>
    <td><strong>#decimalFormat(getConferenceTypes.amount)#</strong></td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0" /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" /></td>
</tr>
                
</table>

    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Register for #REQUEST.companyName# Conference</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>
    
    


</form>


        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        

Open in new window



Confirmation page; the Register page relocates to here:

<!-----
Name:        ConfirmationPage.cfm
Author:      EB / _agx_ / gdemaria
Description: second step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->

<!--- set up parameters for conference registration form --->

<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">


<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->



<!--- query to insert new record into registration table --->
			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
                        )
                        
                        
			     VALUES(
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>
        
                   
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>


       
<!--- END queries to update or insert database records ---> 
        
<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>
            
            
     <!--- obtain a valid amount for variable "amount"; this will confirm that amount entered in #REQUEST.conferenceFeeTable# is correct amount --->
     <cfquery name="getConferenceAmount" datasource="#application.datasource#"> 
         SELECT amount, ConferenceFeeTitle
         FROM #REQUEST.conferenceFeeTable# 
         WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#FORM.ConferenceFeeTypeID#">
     </cfquery>

     <cfif getConferenceAmount.recordCount eq 0>
           The payment amount is invalid.
     </cfif>
     
   
     
     <!--- obtain a valid amount for variable "form.PreconferenceAmount"; this will obtain a value for PreconferenceAmount as entered in #request.RegisterTable# --->
     <cfquery name="getPreconferenceAmount" datasource="#application.datasource#"> 
         SELECT PreconferenceAmount
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>
     
   
     
     <!--- add getConferenceAmount.amount and getPreconferenceAmount.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getPreconferenceAmount.PreconferenceAmount)> 

<!--- 
	Generate Authorize.net fingerprint; there are required by authorize.net
--->
	<cfset loginID="(redacted)">
	<cfset transactionKey="(redacted)">
	<cfset description="Nursing Network on Violence Against Women International Conference Registration, April 9 - 11, 2015">
	<cfset label="Send Conference Payment to NNVAWI"> <!--- This is the label on the 'submit' button --->
	<cfset testMode="false">
	<cfset posturl="https://secure.authorize.net/gateway/transact.dll">
	<!--- an invoice is generated using the date and time --->
	<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>
	<!--- a sequence number is randomly generated --->
	<cfset sequence=RandRange(1, 1000)>
	<!--- a timestamp is generated --->
	<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

	<!--- The following lines generate the SIM fingerprint --->
	<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">
	<cfset fingerprint=digest>


<!--- 
	Display confirmation form.
--->

<!--- BEGIN CFOUTPUTONLY --->  
       
<cfsetting enablecfoutputonly="true">
<cfoutput>
       
<cfinclude template="/SiteHeader.cfm">


<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

<div class="center">
               <input type="button" value="Go Back" onclick="history.go(-1)" />
</div>
             
             <cfabort>
</cfif>

<h1><i class="icon-asterisk"></i></span> Please review the information you have entered.</h1>

<!--- if user needs to edit this registration record, then let's make sure she edits the correct record --->

  <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>
    
    
<h2><i class="icon-asterisk"></i></span> When you are confident, please click the "Proceed to Secure Payment" button to enter your payment information.</h2>
    
    
    <p><strong>You entered the following information:</strong></p>
    
    

<form method="post" action="https://secure.authorize.net/gateway/transact.dll" name="ebwebworkForm" class="ebwebworkForm">

	<!--- values required by authorize.net --->
	
	<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />

 	
	<!--- Embed RegisterID (PK) to assign a value to it --->
	<input type="hidden" name="RegisterID" value="#form.RegisterID#" />
	<INPUT type="hidden" name="x_amount" value="#amount#" />

	<!--- Embed all other values as hidden fields --->




    <p><strong>Conference Registration:</strong> <span class="bold blue">#getConferenceAmount.ConferenceFeeTitle#</span></p>
	
    <p><strong>Conference Payment Amount:</strong> <span class="bold green">$#decimalFormat(amount)#</span></p>
    
    <p><strong>Preconference session hosted by the CDC:</strong> <cfif form.PreconferenceAmount IS NOT ""><em>Preconference session was selected. The Preconference fee is included in the amount above.</em><cfelse><em>Not selected / not attending.</em></cfif></p>
    
    <p><strong>Title:</strong> #form.Title#</p>
    
	<p><strong>First Name:</strong> #form.x_first_name#</p>
    <input type="hidden" name="x_first_name" value="#form.x_first_name#"/>
    
	<p><strong>Last Name:</strong> #form.x_last_name#</p>
    <input type="hidden" name="x_last_name" value="#form.x_last_name#" />

	<p><strong>Middle Initial:</strong> #form.MiddleInitial#</p>

	<p><strong>Credentials:</strong> #form.Credentials#</p>
    
    <p><strong>Organization:</strong> #form.x_company#</p>
    <input type="hidden" name="x_company" value="#form.x_company#" />
    
    <p><strong>Address:</strong> #form.x_address#</p>
    <input type="hidden" name="x_address" value="#form.x_address#" />

    <p><strong>City:</strong> #form.x_city#</p>
    <input type="hidden" name="x_city" value="#form.x_city#" />    

    <p><strong>State:</strong> #form.x_state#</p>
    <input type="hidden" name="x_state" value="#form.x_state#" />    
    
    <p><strong>ZIP or Postal Code:</strong> #form.x_zip#</p>
    <input type="hidden" name="x_zip" value="#form.x_zip#" />

    <p><strong>Country:</strong> #form.x_country#</p>
    <input type="hidden" name="x_country" value="#form.x_country#" />

	<p><strong>Telephone Home:</strong> <cfif form.TelephoneHome IS NOT "">#form.TelephoneHome#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Work:</strong> <cfif form.TelephoneWork IS NOT "">#form.TelephoneWork#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Mobile:</strong> <cfif form.TelephoneMobile IS NOT "">#form.TelephoneMobile#<cfelse>None given.</cfif></p>

    <p><strong>Email:</strong> #form.x_email#</p>
    <input type="hidden" name="x_email" value="#form.x_email#" />

    	<p><strong>Special Requirements:</strong> <cfif form.SpecialRequirements IS NOT "">#form.SpecialRequirements#<cfelse>None given.</cfif></p>

<div class="submitButton">

   <button name="doSave" type="submit" class="green">Proceed to Secure Payment</button>

</div>

</form>


        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        <!--- END CFOUTPUTONLY --->  
                                          

Open in new window



Edit page: If the user reviews the output on the Confirmation page, then clicks the big green edit button, she goes to this page:

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: update x_company conference registration records
Created: July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">



<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

<!--- the action is UPDATE --->

<!--- query UpdateUser updates a page record in content table --->
            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">

           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>
     

<!--- when finished? relocate --->

<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#">



             
<!--- END: Save action --->

<!--- END form.doSave --->
                    </cfif>
       
 

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/SiteHeader.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type=button value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">

Open in new window



That's all the code. What happens, currently, is: the register form processes, but when the confirmation page gives a Server 500 error. So, ColdFusion does not like something. A pernicious new quirtk of my new ColdFusion 11 server is, the server refuses to show me debugging output even when debugging is enabled. I am presently looking at the confirmation page -- I think something is wrong there.

I am very grateful for any input about the three templates above. Thanks as always. =)

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
... for one thing, the UPDATE statement is included in the confirmation page, where it does not belong. I am fixing that. New confirmation page code, on the way.
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
First recommendation/question Eric -
Your edit page and your registration page look very similar.   It seems the form may be the same, the only difference is at the top with the action.  On page you have an insert and the other an update statement.

Would it be easier for you to have only one page and in your action just have a CFIF statement that looks for the primary key:

    <CFIF val(form.RegisterID)>
        (do update)
    <cfelse>  
        (do Insert)
    </cfif>

I've modified your edit page to do just this... check our the action part at the top..

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: update x_company conference registration records
Created: July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">



<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

   <cfif val(form.RegisterID) eq 0>    <!--- ID does not exists, so query to insert new record into registration table --->

			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
)   VALUES   (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>
              
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>
	  
   <cfelse>  <!---- ID already assigned, record already exists, so do an update ---->

            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>

   </cfif>   <!---- end if ID exists do update or insert ---->
     
<!--- when finished? relocate --->
<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#">


<!--- END form.doSave --->
         </cfif>
       

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/SiteHeader.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type=button value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">
                                          

Open in new window

0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
This makes sense. So, then, would my application work like so:

1) User fills in registration page form; and the action of the form is the edit page: editRegistrants.cfm

2) When user submits the register form, the editRegistrants.cfm page is processed, and the user sees the confirmation page using a CFLOCATION, like so:

<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#" addtoken="yes">

Open in new window


3) The confirmation page displays the inputted data, and has a big green Edit button like this:

<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 

Open in new window


4) User clicks big green Edit button; sees the editRegistration.cfm page; makes her edits; submits the form; the action of the form is Update, because of this:

    <CFIF val(form.RegisterID)>
        (do update)
    <cfelse>  
        (do Insert)
    </cfif>

Open in new window


5) This is making sense so far. My question: after step 4, how do I get back to the correct Confirmation page that shows the correct registration ID? CFLOCATION, like this?

<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#">

Open in new window

0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
This is making more sense. I will have another update in the morning. gd, thank you as always. Hope you are well.

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Sorry about the delay ... it has been a day of putting out fires. I am making progress and will have an update soon. Hope your day is going great. I need to go put out one more fire then I can resume work on this task. =) Take care.

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Good morning. I apologize for getting back to this so late. Here is where I am:

My register form does not seem to want to process. The action of the form is the Edit page:

<form method="post" action="editRegistrants.cfm" name="ebwebworkForm" class="ebwebworkForm">

When I fill in the register form and do Submit, then I am sent to a blank editRegistrants.cfm page:

http://nnvawi.org/editRegistrants.cfm

... that makes sense, because all of the insert and update activity occurs within the boundaries of the Save action:

<cfif IsDefined("FORM.doSave")>
... stuff happens .... insert and update ...
</cfif>

Meaning .... the Save action happens only when the Submit button is clicked on the Edit page. So I understand -- I think -- what is going on.

On the Edit page, should I move the INSERT action outside of the Save action?

How do you see this Edit page working with the Register page and the confirmation page?

Does my plan -- http://www.experts-exchange.com/Programming/Languages/Scripting/Cold_Fusion_Markup_Language/Q_28603217.html#a40587121 -- make sense?

I am floundering a bit here. Sorry to drag this on. Thanks as always for your help.

Eric

Register page -- contains only the FORM, no insert or update code:
<!-----
Name:        RegisterConference.cfm
Author:      EB / _agx_
Description: first step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: August 2014
ColdFusion Version 9
MS SQL Server 2012
----->


       <cfoutput>
<cfinclude template="/SiteHeader.cfm">


<!--- form begins here; form action is step two: editRegistrants.cfm --->
<form method="post" action="editRegistrants.cfm" name="ebwebworkForm" class="ebwebworkForm">

 

  <ul>
        <li>
<legend><h2>Conference Registration</h2></legend>
      </li>
      

<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="" maxlength="255" tabindex="1" size="70" autofocus="true" />
               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
        
             
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
         
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>


<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    

  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         
           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li>  
           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  
           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     

           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>     



           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     
<li>
  <label for="x_email"><h3>Email Address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter email address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate email address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="" maxlength="128" tabindex="17" size="70" />
              
</li>                   
      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="" maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>



<p><i class="icon-check green"></i> Take advantage of lower fees for NNVAWI members by selecting the 'Join/Renew and Register' rate. Membership fees are for the 2015 calendar year.</p>

<p><i class="icon-check green"></i> If you have PAID membership fees for 2015, please select the member rate.</p>
 




<h2>Payment Options</h2>

<p><em>All fees are payable in U.S. Funds.</em></p>


<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM #REQUEST.conferenceFeeTable#
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td><strong>#getConferenceTypes.ConferenceFeeTitle#</strong></td>
    <td><strong>#decimalFormat(getConferenceTypes.amount)#</strong></td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0" /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" /></td>
</tr>
                
</table>


     
    <li>
<div class="submitButton">
   <cfoutput>  
   <button type="doSave" class="green" tabindex="19">Register for #REQUEST.companyName# Conference</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>
    
    


</form>

        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        

Open in new window


The action of the Register page, above, is editRegistrants.cfm:

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: update x_company conference registration records
Created: July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">



<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

 <cfif val(form.RegisterID) eq 0>    <!--- ID does not exists, so query to insert new record into registration table --->

			<cfquery name="InsertRecord" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
)   VALUES   (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>
              
      
      
  <!--- Notify NNVAWI that a NEW conference registration has been submitted --->
 <cfmail ...
(cfmail stuff)
</cfmail>
      
      <!--- Notify registrant that her conference registration has been submitted --->
 <cfmail ...
(cfmail stuff)
</cfmail>
	  
   <cfelse>  <!---- ID already assigned, record already exists, so do an update ---->

  <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>

</cfif>   <!---- end if ID exists do update or insert ---->




<!--- when finished? relocate --->

<cflocation url="/confirmationPageNew.cfm?RegisterID=#val(form.RegisterID)#">

</cfif><!--- END if form.doSave exists --->
       
 

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/SiteHeader.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type=button value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">

Open in new window


The editRegistrants.cfm relocates to the Confirmation page:

<!-----
Name:        ConfirmationPage.cfm
Author:      EB / _agx_ / gdemaria
Description: second step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: Feburary 2015
ColdFusion Version 11
MS SQL Server 2012
----->

<!--- set up parameters for conference registration form --->

<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">


    
            
     <!--- obtain a valid amount for variable "amount"; this will confirm that amount entered in #REQUEST.conferenceFeeTable# is correct amount --->
     <cfquery name="getConferenceAmount" datasource="#application.datasource#"> 
         SELECT amount, ConferenceFeeTitle
         FROM #REQUEST.conferenceFeeTable# 
         WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#FORM.ConferenceFeeTypeID#">
     </cfquery>

     <cfif getConferenceAmount.recordCount eq 0>
           The payment amount is invalid.
     </cfif>
     
   
     
     <!--- obtain a valid amount for variable "form.PreconferenceAmount"; this will obtain a value for PreconferenceAmount as entered in #request.RegisterTable# --->
     <cfquery name="getPreconferenceAmount" datasource="#application.datasource#"> 
         SELECT PreconferenceAmount
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>
     
   
     
     <!--- add getConferenceAmount.amount and getPreconferenceAmount.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getPreconferenceAmount.PreconferenceAmount)> 



<!--- 
	Generate Authorize.net fingerprint
--->
	<cfset loginID="redacted">
	<cfset transactionKey="redacted">
	<cfset description="Nursing Network on Violence Against Women International Conference Registration, April 9 - 11, 2015">
	<cfset label="Send Conference Payment to NNVAWI"> <!--- This is the label on the 'submit' button --->
	<cfset testMode="false">
	<cfset posturl="https://secure.authorize.net/gateway/transact.dll">
	<!--- an invoice is generated using the date and time --->
	<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>
	<!--- a sequence number is randomly generated --->
	<cfset sequence=RandRange(1, 1000)>
	<!--- a timestamp is generated --->
	<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

	<!--- The following lines generate the SIM fingerprint --->
	<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">
	<cfset fingerprint=digest>


<!--- 
	Display confirmation form.
--->

<!--- BEGIN CFOUTPUTONLY --->  
       
<cfsetting enablecfoutputonly="true">
<cfoutput>
       
<cfinclude template="/SiteHeader.cfm">


<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

<div class="center">
               <input type="button" value="Go Back" onclick="history.go(-1)" />
</div>
             
             <cfabort>
</cfif>

<h1><i class="icon-asterisk"></i></span> Please review the information you have entered.</h1>


   <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>
    
    
<h2><i class="icon-asterisk"></i></span> When you are confident, please click the "Proceed to Secure Payment" button to enter your payment information.</h2>
    
    
    <p><strong>You entered the following information:</strong></p>
    
    

<form method="post" action="https://secure.authorize.net/gateway/transact.dll" name="ebwebworkForm" class="ebwebworkForm">
	
	<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />

 	
	<!--- Embed RegisterID (PK) to assign a value to it --->
	<input type="hidden" name="RegisterID" value="#form.RegisterID#" />
	<INPUT type="hidden" name="x_amount" value="#amount#" />

	<!--- Embed all other values as hidden fields --->




    <p><strong>Conference Registration:</strong> <span class="bold blue">#getConferenceAmount.ConferenceFeeTitle#</span></p>
	
    <p><strong>Conference Payment Amount:</strong> <span class="bold green">$#decimalFormat(amount)#</span></p>
    
    <p><strong>Preconference session hosted by the CDC:</strong> <cfif form.PreconferenceAmount IS NOT ""><em>Preconference session was selected. The Preconference fee is included in the amount above.</em><cfelse><em>Not selected / not attending.</em></cfif></p>
    
    <p><strong>Title:</strong> #form.Title#</p>
    
	<p><strong>First Name:</strong> #form.x_first_name#</p>
    <input type="hidden" name="x_first_name" value="#form.x_first_name#"/>
    
	<p><strong>Last Name:</strong> #form.x_last_name#</p>
    <input type="hidden" name="x_last_name" value="#form.x_last_name#" />

	<p><strong>Middle Initial:</strong> #form.MiddleInitial#</p>

	<p><strong>Credentials:</strong> #form.Credentials#</p>
    
    <p><strong>Organization:</strong> #form.x_company#</p>
    <input type="hidden" name="x_company" value="#form.x_company#" />
    
    <p><strong>Address:</strong> #form.x_address#</p>
    <input type="hidden" name="x_address" value="#form.x_address#" />

    <p><strong>City:</strong> #form.x_city#</p>
    <input type="hidden" name="x_city" value="#form.x_city#" />    

    <p><strong>State:</strong> #form.x_state#</p>
    <input type="hidden" name="x_state" value="#form.x_state#" />    
    
    <p><strong>ZIP or Postal Code:</strong> #form.x_zip#</p>
    <input type="hidden" name="x_zip" value="#form.x_zip#" />

    <p><strong>Country:</strong> #form.x_country#</p>
    <input type="hidden" name="x_country" value="#form.x_country#" />

	<p><strong>Telephone Home:</strong> <cfif form.TelephoneHome IS NOT "">#form.TelephoneHome#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Work:</strong> <cfif form.TelephoneWork IS NOT "">#form.TelephoneWork#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Mobile:</strong> <cfif form.TelephoneMobile IS NOT "">#form.TelephoneMobile#<cfelse>None given.</cfif></p>

    <p><strong>Email:</strong> #form.x_email#</p>
    <input type="hidden" name="x_email" value="#form.x_email#" />

    	<p><strong>Special Requirements:</strong> <cfif form.SpecialRequirements IS NOT "">#form.SpecialRequirements#<cfelse>None given.</cfif></p>

<div class="submitButton">

   <button name="doSave" type="submit" class="green">Proceed to Secure Payment</button>

</div>

</form>

<h2 class="center"><i class="icon-asterisk"></i></span> NNVAWI uses authorize.net to process secure online transactions. On pressing <em>Proceed</em>, above, you will be taken to a secure payment page on authorize.net.</h2>

<p class="center"><span class="green"><i class="icon-asterisk"></i></span> <em>An NNVAWI administrator will review and confirm your registration. Please
contact Melissa Sutherland at <a href="mailto:melissa.sutherland@bc.edu">melissa.sutherland@bc.edu</a> for information or assistance with conference registration.</em></p>

        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        <!--- END CFOUTPUTONLY --->  
                                          

Open in new window

0
 
LVL 39

Accepted Solution

by:
gdemaria earned 461 total points
Comment Utility
Eric, just focusing on the form and the action pages, I am a little confused by the first two files you provided.   The files don't seem to contain the right parts of the code.   I think the action file should contains the insert/update statements (including the CFTRY/CFCATCH and CFIF insert/update).    The form page needs to have the query that populates the form fields, etc.  

I thought the code I posted previously would work for you.   This is the registration page with both insert/update actions at the top.   I thought this would work for your new registrations and to update an existing registration, did it not work?

I did notice that the registrationID was not included in the form.  That would prevent it from updating, it would always just insert.   I added it in this version as shown here..

<div class="submitButton">
   <cfoutput>  
   <input type="Hidden" name="RegisterID" value="#form.RegisterID#">
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  

Open in new window



Here is the full file again...

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: update x_company conference registration records
Created: July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">



<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

   <cfif val(form.RegisterID) eq 0>    <!--- ID does not exists, so query to insert new record into registration table --->

			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
)   VALUES   (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>
              
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>
	  
   <cfelse>  <!---- ID already assigned, record already exists, so do an update ---->

            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>

   </cfif>   <!---- end if ID exists do update or insert ---->
     
<!--- when finished? relocate --->
<cflocation url="/confirmationPage.cfm?RegisterID=#val(form.RegisterID)#">


<!--- END form.doSave --->
         </cfif>
       

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/SiteHeader.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type=button value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <input type="Hidden" name="RegisterID" value="#form.RegisterID#">
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">
                                          
                                          

Open in new window

0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
gdemaria,

OK, I was confused. I have replaced the edit page, EditRegistrants.cfm, with the exact code you provide above.

I agree -- let's focus on the form and action for now. I think the edit form is OK, per your notes above.

>>> The form page needs to have the query that populates the form fields, etc.  

So, the form / register page needs an insert query also?
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Should the Register / Form page have an insert query? Something like below?

And should the FORM action be:

<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">

or

<form method="post" action="editRegistrants.cfm" name="ebwebworkForm" class="ebwebworkForm">
 
Thanks again for your patient help.

Eric

<!-----
Name:        Register2015.cfm
Author:      EB / _agx_ / gdemaria
Description: first step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: 20150127
ColdFusion Version 11
MS SQL Server 2012
----->

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">


<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- begin form.doSave --->

<cfif IsDefined("FORM.doSave")>

<!--- query to insert new record into registration table --->
			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
                        )
                        
                        
			     VALUES(
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>

              
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>


       <!--- done? relocate --->

<cflocation url="/confirmationPageNew.cfm?RegisterID=#val(form.RegisterID)#" addtoken="yes">
       

<!--- END form.doSave --->
                    </cfif>
        
<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
			</cftry>



       <cfoutput>
<cfinclude template="/SiteHeader.cfm">


<!--- form begins here --->
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">

<!--- which action to use? --->

<form method="post" action="editRegistrants.cfm" name="ebwebworkForm" class="ebwebworkForm">
 

  <ul>
        <li>
<legend><h2>Conference Registration</h2></legend>
      </li>
      

<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="" maxlength="255" tabindex="1" size="70" autofocus="true" />
               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
        
             
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
         
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>


<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    

  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         
           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li>  
           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  
           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     

           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>     



           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     
<li>
  <label for="x_email"><h3>Email Address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter email address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate email address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="" maxlength="128" tabindex="17" size="70" />
              
</li>                   
      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="" maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>



<p><i class="icon-check green"></i> Take advantage of lower fees for NNVAWI members by selecting the 'Join/Renew and Register' rate. Membership fees are for the 2015 calendar year.</p>

<p><i class="icon-check green"></i> If you have PAID membership fees for 2015, please select the member rate.</p>
 




<h2>Payment Options</h2>

<p><em>All fees are payable in U.S. Funds.</em></p>


<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM #REQUEST.conferenceFeeTable#
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td><strong>#getConferenceTypes.ConferenceFeeTitle#</strong></td>
    <td><strong>#decimalFormat(getConferenceTypes.amount)#</strong></td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0" /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" /></td>
</tr>
                
</table>


     

<p><strong>Full Registration Fee Includes:</strong><br /> 
Continental breakfast, snacks and lunch each day; entry to conference sessions, Thursday evening Opening Reception.</p>  
<p><strong>One-Day Fee Includes:</strong><br />
Continental breakfast, snacks and lunch on the day of registration, and entrance to conference sessions scheduled on that day.</p>

<p><strong>Preconference Fee:</strong> includes interactive sessions hosted by CDC affilitated scientists in the morning and a guided tour of the CDC in the afternoon; morning and afternoon refreshment break; lunch is on your own. For details, see the <a href="http://nnvawi.org/pages/NNVAWI-Conference.cfm">conference program page</a> of this website.</p>

    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Register for #REQUEST.companyName# Conference</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>
    
    


</form>

<p class="center"><span class="red"><i class="icon-asterisk"></i></span> <em>An NNVAWI administrator will review and confirm your registration. Please
contact Melissa Sutherland at <a href="mailto:melissa.sutherland@bc.edu">melissa.sutherland@bc.edu</a> for information or assistance with conference registration.</em></p>

        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        

Open in new window

0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
> So, the form / register page needs an insert query also?

If you use the file I provided, you should be able to both create a new registration and edit an existing registration on that same file.   The difference is whether you pass a registrationID to it on the URL or not.  If not ID, then the form should be blank when the page loads and create a record on SAVE.   If an ID is passed, then the form should be filled with existing data and you should be able to update the database record when SAVE is clicked.  

Can you test to ensure this is happening?  

If the link above is the actual form, I see a 500 error.   Try creating a file in the root folder of this website.  Call the file  web.config  and make this it's contents:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
   <httpErrors errorMode="Detailed" />
   <asp scriptErrorSentToBrowser="true"/>
</system.webServer>
<system.web>
   <customErrors mode="Off"/>
   <compilation debug="true"/>
</system.web>
</configuration>

Open in new window

0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
The difference between these two form tags...
<form method="post" enctype="multipart/form-data" name="ebwebworkForm" class="ebwebworkForm">
or
<form method="post" action="editRegistrants.cfm" name="ebwebworkForm" class="ebwebworkForm">

One of them includes this:   enctype="multipart/form-data"
This part should be included when your form is uploading a file.   if not file to be uploaded you can skip this

Also, one of the <form tags include the action:   action="editRegistrants.cfm"
If you do not include the action, the form posts to itself.   It looks like this action contains the name of the form's file so it would post to itself either way.   Perhaps include it just to be clear that when you post the form, you want to post to the same file (itself).
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Got it. This advice makes sense. I will implement this tonight and show you my results in the morning. Unfortunately I am stuck in meetings for the foreseeable future. =( But your notes above make a lot of sense. I'll have more results soon.

Hope you're well today!

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Good morning, gdemaria. =)  I am making progress. Also, I set up web.config per your notes above.

My test register form -- http://nnvawi.org/register2015new.cfm --  and test EditRegistration.cfm form seem to be doing their work. The Edit page inserts a new record, and then shows me the confirmation page:

http://nnvawi.org/confirmationPageNew.cfm?RegisterID=3247

I worked through some errors and the confirmation page displays without error.

However, while the Edit page does its insert correctly, the confirmation page does not display the values from the edit page. Title, Last Name, First Name, Amount, and so on are blank.

Hmmm. Maybe I need to add a new query to the Confirmation page to request all of that information from the data table. Or can I carry over that information from the Edit page?

http://nnvawi.org/register2015new.cfm -- register here. Then --

Here are the Edit and Confirmation pages:

EditRegistrants.cfm:

<!-----
Name:        editRegistrants.cfm
Author:      Eric Bourland / _agx_ / gdemaria
Description: update x_company conference registration records
Created: July 2014
Revised: February 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">

<!--- set default values for other user-editable fields --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">

     <!--- set default values for radio buttons --->
     <cfparam name="form.ConferenceFeeType" default="">



<!--- in user-editable fields, set up protection against XSS  --->
    <cfloop collection="#FORM#" item="field">
      <cfset FORM[ field ] = ReReplaceNoCase (FORM[ field ], "<script.*?>.*?</script>", "", "all")>
    </cfloop>


<!--- query editRegister tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="editRegister">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
</cfquery>

		   
<!---- begin CFTRY; catch errors ---->
<cftry>  
 
<!---- populate cftry with error message ---->
<cfset variables.error = ""> 
 
<!--- BEGIN: Save action --->

<cfif IsDefined("FORM.doSave")>

   <cfif val(form.RegisterID) eq 0>    <!--- ID does not exists, so query to insert new record into registration table --->

			<cfquery name="InsertPage" datasource="#application.datasource#" result="newRegistrant">
				 INSERT INTO #REQUEST.RegisterTable#
     					(
Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
)   VALUES   (
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
<cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
<cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
<cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
)         
					</cfquery>
              
<!--- use the result attribute value (newRegistrant) to set form field value --->
      <cfset form.RegisterID = newRegistrant.IDENTITYCOL>
	  
   <cfelse>  <!---- ID already assigned, record already exists, so do an update ---->

            <cfquery name="UpdateUser" datasource="#application.datasource#">
				  UPDATE #REQUEST.RegisterTable#
				  SET
Title = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Title,50))#">,
x_first_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_first_name,255))#">,
MiddleInitial = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.MiddleInitial,5))#">,
x_last_name = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_last_name,255))#">,
Credentials = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.Credentials,255))#">,
x_company = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_company,255))#">,
x_address = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_address,255))#">,
x_city = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_city,255))#">,
x_state = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_state,255))#">,
x_zip = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_zip,255))#">,
x_country = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_country,255))#">,
TelephoneHome = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneHome,25))#">,
TelephoneWork = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneWork,25))#">,
TelephoneMobile = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.TelephoneMobile,25))#">,
FAX = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.FAX,25))#">,
x_email = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.x_email,128))#">,
AltUserEmail = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.AltUserEmail,128))#">,
SpecialRequirements = <cfqueryparam cfsqltype="cf_sql_varchar" value="#Trim(Left(form.SpecialRequirements,255))#">,
ConferenceFeeType = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">,
PreconferenceAmount = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.PreconferenceAmount)#">,
DateModified = <cfqueryparam cfsqltype="cf_sql_timestamp" value="#now()#">
           WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
			</cfquery>

   </cfif>   <!---- end if ID exists do update or insert ---->
     
<!--- when finished? relocate --->
<cflocation url="/confirmationPageNew.cfm?RegisterID=#val(form.RegisterID)#">


<!--- END form.doSave --->
         </cfif>
       

<!--- this CFCATCH will trap errors -- the ones you threw or just regular database issues --->
            <cfcatch type="Any">
                 <cfset variables.error = cfcatch.message>
            </cfcatch>

<!--- END CFTRY --->  
</cftry>
       
       
     
<!--- fetch the data from the database only when there are no errors; let the form variables pass back from the data table into the form to display ---->
 
<cfif len(variables.error) eq 0>

  			<cfloop index="aCol" list="#editRegister.columnList#">
			       <cfset "form.#aCol#" = editRegister[aCol][editRegister.currentRow]>
			  </cfloop>
    
</cfif>



       
<cfinclude template="/SiteHeader.cfm">



<!--- if there an error, display error in readable form --->

<cfif len(variables.error)> 
	  <cfoutput>
	    <div class="errorbox">#variables.error#</div>
	    </cfoutput>
   
   <br />

             <div class="align-center">
               <input type="button" value="Go Back" onClick="history.go(-1)">
             </div>
             
             <cfabort>
</cfif>




<!--- form begins here --->
<form method="post" name="ebwebworkForm" class="ebwebworkForm">
                
 
  <ul>
        <li>
<legend><h2>Registration Details</h2></legend>
      </li>
      


<p><span class="red"><i class="icon-asterisk"></i></span> <em>indicates a required field.</em></p>

<li>
  <label for="Title"><h3>Title (Ms., Mr., Dr. etc.):</h3></label>



<input type="text" name="Title" placeholder="Title" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Title,255)))#</cfoutput>" maxlength="255" tabindex="1" size="70" autofocus="true" />

               
</li>
                              
<li>
  <label for="x_first_name"><h3>First Name:</h3></label>


<input type="text" name="x_first_name" placeholder="First Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_first_name,255)))#</cfoutput>" maxlength="255" tabindex="2" size="70" required="yes" />
        <span class="form_hint">Enter First Name</span> 
               
</li>


<li>
  <label for="MiddleInitial"><h3>Middle Initial:</h3></label>


<input type="text" name="MiddleInitial" placeholder="MI" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.MiddleInitial,255)))#</cfoutput>" maxlength="5" tabindex="3" size="1" />
</li>



<li>
  <label for="x_last_name"><h3>Last Name:</h3></label>


<input type="text" name="x_last_name" placeholder="Last Name" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_last_name,255)))#</cfoutput>" maxlength="255" tabindex="4" size="70" required="yes" />
        <span class="form_hint">Enter Last Name</span> 
               
</li>

<li>
  <label for="Credentials"><h3>Credentials:</h3></label>


<input type="text" name="Credentials" placeholder="Credentials (e.g. RN, MSN, PhD, MD)" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.Credentials,255)))#</cfoutput>" maxlength="255" tabindex="5" size="70" required="yes" />
        <span class="form_hint">Credentials (e.g. RN, MSN, PhD, MD)</span> 
               
</li>



<li>
  <label for="x_company"><h3>Current Position and Organization:</h3></label>


<input type="text" name="x_company" placeholder="Current Position and Organization" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_company,255)))#</cfoutput>" maxlength="255" tabindex="6" size="70" required="yes" />
        <span class="form_hint">Enter Current Position and Organization</span> 
               
</li>


    
 
 
  <li>
  <label for="x_address"><h3>Address:</h3></label>


<input type="text" name="x_address" placeholder="Please enter your address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_address,255)))#</cfoutput>" maxlength="255" tabindex="7" size="70" required="yes" />
        <span class="form_hint">Please enter your mailing address</span> 
               
</li>
    


  <li>
  <label for="x_city"><h3>City:</h3></label>


<input type="text" name="x_city" placeholder="Please enter your city" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_city,255)))#</cfoutput>" maxlength="255" tabindex="8" size="70" required="yes" />
        <span class="form_hint">Please enter your city</span> 
               
</li>

         
         
           <li>
  <label for="x_state"><h3>State or Province:</h3></label>


<input type="text" name="x_state" placeholder="Please enter your State or Province" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_state,255)))#</cfoutput>" maxlength="255" tabindex="9" size="70" required="yes" />
        <span class="form_hint">Please enter your State or Province</span> 
               
</li>                     
                         

           <li>
  <label for="x_zip"><h3>ZIP or Postal Code:</h3></label>


<input type="text" name="x_zip" placeholder="Please enter your ZIP or Postal Code" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_zip,25)))#</cfoutput>" maxlength="255" tabindex="10" size="70" required="yes" />
        <span class="form_hint">Please enter your ZIP or Postal Code</span> 
               
</li> 

           <li>
  <label for="x_country"><h3>Country:</h3></label>


<input type="text" name="x_country" placeholder="Please enter your country" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_country,255)))#</cfoutput>" maxlength="255" tabindex="11" size="70" required="yes" />
        <span class="form_hint">Please enter your country</span> 
               
</li>  

           <li>
  <label for="TelephoneHome"><h3>Home Telephone:</h3></label>


<input type="text" name="TelephoneHome" placeholder="Please enter your home telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneHome,25)))#</cfoutput>" maxlength="25" tabindex="12" size="70" />
        <span class="form_hint">Please enter your home telephone number.</span> 
               
</li>     



           <li>
  <label for="TelephoneWork"><h3>Work Telephone:</h3></label>


<input type="text" name="TelephoneWork" placeholder="Please enter your work telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneWork,25)))#</cfoutput>" maxlength="25" tabindex="13" size="70" />
        <span class="form_hint">Please enter your work telephone number.</span> 
               
</li>     


           <li>
  <label for="TelephoneMobile"><h3>Mobile Telephone:</h3></label>


<input type="text" name="TelephoneMobile" placeholder="Please enter your mobile telephone number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.TelephoneMobile,25)))#</cfoutput>" maxlength="25" tabindex="14" size="70" />
        <span class="form_hint">Please enter your mobile telephone number.</span> 
               
</li>   

           <li>
  <label for="FAX"><h3>FAX:</h3></label>


<input type="text" name="FAX" placeholder="Please enter your FAX number" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.FAX,25)))#</cfoutput>" maxlength="25" tabindex="15" size="70" />
        <span class="form_hint">Please enter your FAX number.</span> 
               
</li>     

<li>
  <label for="x_email"><h3>email address:</h3></label>


<input type="text" name="x_email" placeholder="Important: Please enter your valid email address." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.x_email,128)))#</cfoutput>" maxlength="128" tabindex="16" size="70" required="yes" />
        <span class="form_hint">Enter Email Address</span> 
               
</li>


           <li>
  <label for="AltUserEmail"><h3>Alternate Email Address:</h3></label>


<input type="text" name="AltUserEmail" placeholder="Please enter an alternate email address" value="<cfoutput>#HTMLEditFormat(Trim(Left(form.AltUserEmail,128)))#</cfoutput>" maxlength="128" tabindex="17" size="70" />
              
</li>  
                              

      
      <li>
  <label for="SpecialRequirements"><h3>Special Requirements -- dietary, mobility, etc.:</h3></label>


<input type="text" name="SpecialRequirements" placeholder="Important: Please enter special requirements, if any." value="<cfoutput>#HTMLEditFormat(Trim(Left(form.SpecialRequirements,255)))#</cfoutput>" 
maxlength="255" tabindex="18" size="70" />
               
</li>


<h2>Conference Fees</h2>

<cfquery name="getConferenceTypes" datasource="#application.datasource#"> 
    SELECT ConferenceFeeTypeID, ConferenceFeeTitle, amount
    FROM ConferenceFeeType
</cfquery>

<table width="40%" summary="Conference Fee Schedule for NNVAWI Conference, April 9 - 11, 2015">
  <caption>
    <h3>Conference Fees</h3>
  </caption>

<cfloop query="getConferenceTypes">
<cfoutput>
      <tr>
    <td>#getConferenceTypes.ConferenceFeeTitle#</td>
    <td>#decimalFormat(getConferenceTypes.amount)#</td>
	<td><input type="radio" name="ConferenceFeeTypeID" value="#getConferenceTypes.ConferenceFeeTypeID#" class="border0"
     <CFIF val(editRegister.ConferenceFeeType) EQ getConferenceTypes.ConferenceFeeTypeID>checked</CFIF> /></td>
     </tr>
</cfoutput>
</cfloop>

<tr><td><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span> <strong>Extra: Preconference sessions and activities hosted by the CDC (Additional Fee Applies)</strong> <span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span><span class="green"><i class="icon-star"></i></span></td>

<td><strong>100.00</strong></td>

<td><input type="checkbox" name="PreconferenceAmount" value="100.00" class="border0" <CFIF val(editRegister.PreconferenceAmount) IS '100.00'>checked</CFIF> /></td>
</tr>
                

                
</table>
      


    <li>
<div class="submitButton">
   <cfoutput>  
   <button name="doSave" type="submit" class="green" tabindex="19">Update This #REQUEST.companyName# Conference Registration</button>
   </cfoutput>
</div>  
</li>
    
    
    </ul>

</form>



<!--- Page footer --->
<cfinclude template="/admin/admin_footer.cfm">
                                          
                                          
                                          

Open in new window



ConfirmationPageNew.cfm:
<!-----
Name:        ConfirmationPage.cfm
Author:      EB / _agx_ / gdemaria
Description: second step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: Feburary 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">


<!--- set default values for other variables --->
<cfparam name="form.Title" default="">
<cfparam name="form.x_first_name" default="">
<cfparam name="form.MiddleInitial" default="">
<cfparam name="form.x_last_name" default="">
<cfparam name="form.Credentials" default="">
<cfparam name="form.x_company" default="">
<cfparam name="form.x_address" default="">
<cfparam name="form.x_city" default="">
<cfparam name="form.x_state" default="">
<cfparam name="form.x_zip" default="">
<cfparam name="form.x_country" default="">
<cfparam name="form.TelephoneHome" default="">
<cfparam name="form.TelephoneWork" default="">
<cfparam name="form.TelephoneMobile" default="">
<cfparam name="form.FAX" default="">
<cfparam name="form.x_email" default="">
<cfparam name="form.AltUserEmail" default="">
<cfparam name="form.SpecialRequirements" default="">
<cfparam name="form.ConferenceFeeType" default="">
<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">
<cfparam name="form.DateCreated" default="">
<cfparam name="form.DateModified" default="">          


     <!--- obtain a valid amount for variable "amount"; this will confirm that amount entered in #REQUEST.conferenceFeeTable# is correct amount --->
     <cfquery name="getConferenceAmount" datasource="#application.datasource#"> 
         SELECT amount, ConferenceFeeTitle
         FROM #REQUEST.conferenceFeeTable# 
         WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(FORM.ConferenceFeeTypeID)#">
     </cfquery>

     <cfif getConferenceAmount.recordCount eq 0>
           The payment amount is invalid.
     </cfif>
     
   
     
     <!--- obtain a valid amount for variable "form.PreconferenceAmount"; this will obtain a value for PreconferenceAmount as entered in #request.RegisterTable# --->
     <cfquery name="getPreconferenceAmount" datasource="#application.datasource#"> 
         SELECT PreconferenceAmount
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>
     
   
     
     <!--- add getConferenceAmount.amount and getPreconferenceAmount.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getPreconferenceAmount.PreconferenceAmount)> 



<!--- 
	Generate Authorize.net fingerprint
--->
	<cfset loginID="redacted">
	<cfset transactionKey="redacted">
	<cfset description="Nursing Network on Violence Against Women International Conference Registration, April 9 - 11, 2015">
	<cfset label="Send Conference Payment to NNVAWI"> <!--- This is the label on the 'submit' button --->
	<cfset testMode="false">
	<cfset posturl="https://secure.authorize.net/gateway/transact.dll">
	<!--- an invoice is generated using the date and time --->
	<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>
	<!--- a sequence number is randomly generated --->
	<cfset sequence=RandRange(1, 1000)>
	<!--- a timestamp is generated --->
	<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

	<!--- The following lines generate the SIM fingerprint --->
	<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">
	<cfset fingerprint=digest>


<!--- 
	Display confirmation form.
--->

<!--- BEGIN CFOUTPUTONLY --->  
       
<cfsetting enablecfoutputonly="true">
<cfoutput>
       
<cfinclude template="/SiteHeader.cfm">




<h1><i class="icon-asterisk"></i></span> Please review the information you have entered.</h1>


   <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/HideEdit.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>
    
    
<h2><i class="icon-asterisk"></i></span> When you are confident, please click the "Proceed to Secure Payment" button to enter your payment information.</h2>
    
    
    <p><strong>You entered the following information:</strong></p>
    
    

<form method="post" action="https://secure.authorize.net/gateway/transact.dll" name="ebwebworkForm" class="ebwebworkForm">
	
	<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />

 	
	<!--- Embed RegisterID (PK) to assign a value to it --->
	<input type="hidden" name="RegisterID" value="#form.RegisterID#" />
	<INPUT type="hidden" name="x_amount" value="#amount#" />

	<!--- Embed all other values as hidden fields --->




    <p><strong>Conference Registration:</strong> <span class="bold blue">#getConferenceAmount.ConferenceFeeTitle#</span></p>
	
    <p><strong>Conference Payment Amount:</strong> <span class="bold green">$#decimalFormat(amount)#</span></p>
    
    <p><strong>Preconference session hosted by the CDC:</strong> <cfif form.PreconferenceAmount IS NOT ""><em>Preconference session was selected. The Preconference fee is included in the amount above.</em><cfelse><em>Not selected / not attending.</em></cfif></p>
    
    <p><strong>Title:</strong> #form.Title#</p>
    
	<p><strong>First Name:</strong> #form.x_first_name#</p>
    <input type="hidden" name="x_first_name" value="#form.x_first_name#"/>
    
	<p><strong>Last Name:</strong> #form.x_last_name#</p>
    <input type="hidden" name="x_last_name" value="#form.x_last_name#" />

	<p><strong>Middle Initial:</strong> #form.MiddleInitial#</p>

	<p><strong>Credentials:</strong> #form.Credentials#</p>
    
    <p><strong>Organization:</strong> #form.x_company#</p>
    <input type="hidden" name="x_company" value="#form.x_company#" />
    
    <p><strong>Address:</strong> #form.x_address#</p>
    <input type="hidden" name="x_address" value="#form.x_address#" />

    <p><strong>City:</strong> #form.x_city#</p>
    <input type="hidden" name="x_city" value="#form.x_city#" />    

    <p><strong>State:</strong> #form.x_state#</p>
    <input type="hidden" name="x_state" value="#form.x_state#" />    
    
    <p><strong>ZIP or Postal Code:</strong> #form.x_zip#</p>
    <input type="hidden" name="x_zip" value="#form.x_zip#" />

    <p><strong>Country:</strong> #form.x_country#</p>
    <input type="hidden" name="x_country" value="#form.x_country#" />

	<p><strong>Telephone Home:</strong> <cfif form.TelephoneHome IS NOT "">#form.TelephoneHome#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Work:</strong> <cfif form.TelephoneWork IS NOT "">#form.TelephoneWork#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Mobile:</strong> <cfif form.TelephoneMobile IS NOT "">#form.TelephoneMobile#<cfelse>None given.</cfif></p>

    <p><strong>Email:</strong> #form.x_email#</p>
    <input type="hidden" name="x_email" value="#form.x_email#" />

    	<p><strong>Special Requirements:</strong> <cfif form.SpecialRequirements IS NOT "">#form.SpecialRequirements#<cfelse>None given.</cfif></p>

<div class="submitButton">

   <button name="doSave" type="submit" class="green">Proceed to Secure Payment</button>

</div>

</form>

<h2 class="center"><i class="icon-asterisk"></i></span> NNVAWI uses authorize.net to process secure online transactions. On pressing <em>Proceed</em>, above, you will be taken to a secure payment page on authorize.net.</h2>

<p class="center"><span class="green"><i class="icon-asterisk"></i></span> <em>An NNVAWI administrator will review and confirm your registration. Please
contact Melissa Sutherland at <a href="mailto:melissa.sutherland@bc.edu">melissa.sutherland@bc.edu</a> for information or assistance with conference registration.</em></p>

        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        <!--- END CFOUTPUTONLY --->  
                                          

Open in new window


Thank you for your advice. I think I am making progress. Hope your morning is going well. I am getting another cup of coffee.......

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I've been staring at this some more. It seems like the Edit page -- EditRegistrants.cfm -- does not carry over its values to  the confirmation page -- ConfirmationPageNew.cfm.

I think we are close to solving this.

On ConfirmationPageNew.cfm, maybe I need to set up a new query -- getRegistrationDetails -- to get the values of the current record (identified by form.RegisterID).

I will try that out.
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
Yes, if your edit page is all set, all you need to do is pass the ID to the confirmation page.   The confirmation page should do the query again and that will display the values in text on the screen.    That seems a lot easier and more secure than passing all the form field values
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
I think I've almost got it. I am having trouble getting one value, amount, to display.

I derive amount like this, using a couple of queries and cfset:

     <!--- add getConferenceAmount.amount and getRegistrationDetails.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getRegistrationDetails.PreconferenceAmount)>

But my confirmation page refuses to display a value amount.

I am a little stuck with this one. I wonder if the value for form.ConferenceFeeTypeID carries over from the editRegistration.cfm page? If I do not have a correct value for form.ConferenceFeeTypeID, then I cannot get a correct value for variable #amount#.

I've been trying different ideas but am not yet successful. What do you think I am missing? Thanks as always. Hope you are well.

Eric

<!-----
Name:        ConfirmationPage.cfm
Author:      EB / _agx_ / gdemaria
Description: second step of registration process: 1) User enters data in registration form and sees confirmation page; 2) in confirmation page: populate MSSQL data table with data entered in this registration form; and: 3) populate authorize.net payment page with this same data
Created:     July 2014
Revised: Feburary 2015
ColdFusion Version 11
MS SQL Server 2012
----->


<!--- set a default value "" for RegisterID in scope URL --->
<cfparam name="url.RegisterID" default="">

<!--- define the RegisterID in scope FORM, then set form.RegisterID equal to the RegisterID passed in the URL --->
<cfparam name="form.RegisterID" default="#url.RegisterID#">


<!--- set default values for other variables --->

<cfparam name="form.ConferenceFeeTypeID" default="">
<cfparam name="form.PreconferenceAmount" default="">

<!--- query getRegistrationDetails  tells ColdFusion which record to edit--->
<cfquery datasource="#application.datasource#" name="getRegistrationDetails">
SELECT RegisterID
,Title
,x_first_name
,MiddleInitial
,x_last_name
,Credentials
,x_company
,x_address
,x_city
,x_state
,x_zip
,x_country
,TelephoneHome
,TelephoneWork
,TelephoneMobile
,FAX
,x_email
,AltUserEmail
,SpecialRequirements
,ConferenceFeeType
,PreconferenceAmount
,DateCreated
   
FROM #request.RegisterTable#
WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(url.RegisterID)#">
</cfquery>       


<!--- obtain a valid amount for variable "amount" from the Conference Fee lookup table #REQUEST.conferenceFeeTable#; this will confirm that amount entered in #REQUEST.conferenceFeeTable# is correct amount --->
     <cfquery name="getConferenceAmount" datasource="#application.datasource#"> 
         SELECT amount, ConferenceFeeTitle
         FROM #REQUEST.conferenceFeeTable# 
         WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">
     </cfquery>

     <cfif getConferenceAmount.recordCount eq 0>
           The payment amount is invalid.
     </cfif>
     
   
     
     <!--- add getConferenceAmount.amount and getRegistrationDetails.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getRegistrationDetails.PreconferenceAmount)> 



<!--- 
	Generate Authorize.net fingerprint
--->
	<cfset loginID="redacted">
	<cfset transactionKey="redacted">
	<cfset description="Nursing Network on Violence Against Women International Conference Registration, April 9 - 11, 2015">
	<cfset label="Send Conference Payment to NNVAWI"> <!--- This is the label on the 'submit' button --->
	<cfset testMode="false">
	<cfset posturl="https://secure.authorize.net/gateway/transact.dll">
	<!--- an invoice is generated using the date and time --->
	<cfset invoice=DateFormat(Now(),"yyyymmdd") & TimeFormat(Now(),"HHmmss")>
	<!--- a sequence number is randomly generated --->
	<cfset sequence=RandRange(1, 1000)>
	<!--- a timestamp is generated --->
	<cfset timestamp=DateDiff("s", "January 1 1970 00:00", DateConvert('local2UTC', Now())) >

	<!--- The following lines generate the SIM fingerprint --->
	<cf_hmac data="#loginID#^#sequence#^#timestamp#^#amount#^" key="#transactionKey#">
	<cfset fingerprint=digest>


<!--- 
	Display confirmation form.
--->

<!--- BEGIN CFOUTPUTONLY --->  
       
<cfsetting enablecfoutputonly="true">
<cfoutput>
       
<cfinclude template="/SiteHeader.cfm">




<h1><i class="icon-asterisk"></i></span> Please review the information you have entered.</h1>


   <cfquery name="getRegisterID" datasource="#application.datasource#"> 
         SELECT RegisterID
         FROM #request.RegisterTable#
         WHERE RegisterID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.RegisterID)#">
     </cfquery>

<p>If you need to make changes, please <em>do not</em> page back in your web browser; doing so creates a problem. Rather, click the Edit Registration button, immediately below.</p>

<div class="center">
<a class="button green" href="/editRegistrants.cfm?RegisterID=#val(getRegisterID.RegisterID)#">Edit Registration</a> 
</div>
    
    
<h2><i class="icon-asterisk"></i></span> When you are confident, please click the "Proceed to Secure Payment" button to enter your payment information.</h2>
    
    
    <p><strong>You entered the following information:</strong></p>
    
    

<form method="post" action="https://secure.authorize.net/gateway/transact.dll" name="ebwebworkForm" class="ebwebworkForm">
	
	<INPUT type='hidden' name='x_login' value='#loginID#' />
	<INPUT type='hidden' name='x_description' value='#description#' />
	<INPUT type='hidden' name='x_invoice_num' value='#invoice#' />
	<INPUT type='hidden' name='x_fp_sequence' value='#sequence#' />
	<INPUT type='hidden' name='x_fp_timestamp' value='#timeStamp#' />
	<INPUT type='hidden' name='x_fp_hash' value='#fingerprint#' />
	<INPUT type='hidden' name='x_test_request' value='#testMode#' />
	<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />

 	
	<!--- Embed RegisterID (PK) to assign a value to it --->
	<input type="hidden" name="RegisterID" value="#form.RegisterID#" />
	<INPUT type="hidden" name="x_amount" value="#amount#" />

	<!--- Embed all other values as hidden fields --->




    <p><strong>Conference Registration:</strong> <span class="bold blue">#getConferenceAmount.ConferenceFeeTitle#</span></p>
	
    <p><strong>Conference Payment Amount:</strong> <span class="bold green">$#decimalFormat(amount)#</span></p>
    
    <p><strong>Preconference session hosted by the CDC:</strong> <cfif getRegistrationDetails.PreconferenceAmount IS NOT ""><em>Preconference session was selected. The Preconference fee is included in the amount above.</em><cfelse><em>Not selected / not attending.</em></cfif></p>
    
    <p><strong>Title:</strong> #getRegistrationDetails.Title#</p>
    
	<p><strong>First Name:</strong> #getRegistrationDetails.x_first_name#</p>
    <input type="hidden" name="x_first_name" value="#getRegistrationDetails.x_first_name#"/>
    
  	<p><strong>Middle Initial:</strong> #getRegistrationDetails.MiddleInitial#</p>
    
	<p><strong>Last Name:</strong> #getRegistrationDetails.x_last_name#</p>
    <input type="hidden" name="x_last_name" value="#getRegistrationDetails.x_last_name#" />

	<p><strong>Credentials:</strong> #getRegistrationDetails.Credentials#</p>
    
    <p><strong>Organization:</strong> #getRegistrationDetails.x_company#</p>
    <input type="hidden" name="x_company" value="#getRegistrationDetails.x_company#" />
    
    <p><strong>Address:</strong> #getRegistrationDetails.x_address#</p>
    <input type="hidden" name="x_address" value="#getRegistrationDetails.x_address#" />

    <p><strong>City:</strong> #getRegistrationDetails.x_city#</p>
    <input type="hidden" name="x_city" value="#getRegistrationDetails.x_city#" />    

    <p><strong>State:</strong> #getRegistrationDetails.x_state#</p>
    <input type="hidden" name="x_state" value="#getRegistrationDetails.x_state#" />    
    
    <p><strong>ZIP or Postal Code:</strong> #getRegistrationDetails.x_zip#</p>
    <input type="hidden" name="x_zip" value="#getRegistrationDetails.x_zip#" />

    <p><strong>Country:</strong> #getRegistrationDetails.x_country#</p>
    <input type="hidden" name="x_country" value="#getRegistrationDetails.x_country#" />

	<p><strong>Telephone Home:</strong> <cfif getRegistrationDetails.TelephoneHome IS NOT "">#getRegistrationDetails.TelephoneHome#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Work:</strong> <cfif getRegistrationDetails.TelephoneWork IS NOT "">#getRegistrationDetails.TelephoneWork#<cfelse>None given.</cfif></p>

	<p><strong>Telephone Mobile:</strong> <cfif getRegistrationDetails.TelephoneMobile IS NOT "">#getRegistrationDetails.TelephoneMobile#<cfelse>None given.</cfif></p>

    <p><strong>Email:</strong> #getRegistrationDetails.x_email#</p>
    <input type="hidden" name="x_email" value="#getRegistrationDetails.x_email#" />

    	<p><strong>Special Requirements:</strong> <cfif getRegistrationDetails.SpecialRequirements IS NOT "">#getRegistrationDetails.SpecialRequirements#<cfelse>None given.</cfif></p>

<div class="submitButton">

   <button name="doSave" type="submit" class="green">Proceed to Secure Payment</button>

</div>

</form>



        <cfinclude template="/SiteFooter.cfm">
        
</cfoutput>        <!--- END CFOUTPUTONLY --->  
                                          

Open in new window

0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
Ok, let's look at this..  your amount comes from two values...

     <cfset amount = val(getConferenceAmount.amount) + val(getRegistrationDetails.PreconferenceAmount)>


Just before this line you have...
     <cfif getConferenceAmount.recordCount eq 0>
           The payment amount is invalid.
     </cfif>
     
This will show a message if the getConferenceAmount returns no records.
So, let's expand this to find out which query has no value in it,  try adding this block of code before the addition to see which query is not giving you anything...

     <cfif getConferenceAmount.recordCount eq 0>
           The getConferenceAmount did not return any records
     <cfelseif val(getConferenceAmount.amount) eq 0>
           getConferenceAmount.amount is empty/zero
     </cfif>
     <cfif getRegistrationDetails.recordCount eq 0>
           The getRegistrationDetails did not return any records.
     <cfelseif val(getRegistrationDetails.PreconferenceAmount) eq 0>
           getRegistrationDetails.PreconferenceAmount is empty/zero
     </cfif>
     
     <!--- add getConferenceAmount.amount and getRegistrationDetails.PreconferenceAmount to obtain a combined amount to deliver to authorize.net --->
     <cfset amount = val(getConferenceAmount.amount) + val(getRegistrationDetails.PreconferenceAmount)> 

   <h1>The Amount is <cfoutput>#amount#</cfoutput> </h1>

Open in new window

0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
Got it. I added that test code.

Here's the  output on the confirmation page:

The payment amount is invalid. The getConferenceAmount did not return any records
<h1>The Amount is 100</h1>

The value 100 comes from checking the PreConference box on the registration page.

So, any payment amount I select from the radio buttons on the registration page does not appear in the results of query.

The edit form properly inserts a ConferenceFeeType into the data table. I just registered as a test case; I chose radio button "Paid member (2015) - Full Conference (Before Feb 1 2015)"; and the edit form properly inserted value "3" for ConferenceFeeType.

But the Confirmation page does not derive the correct value for amount.

I think I need to edit this query:

     <cfquery name="getConferenceAmount" datasource="#application.datasource#"> 
         SELECT amount, ConferenceFeeTitle
         FROM #REQUEST.conferenceFeeTable# 
         WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(form.ConferenceFeeTypeID)#">
     </cfquery>

Open in new window


I think the WHERE clause should be:

       WHERE ConferenceFeeTypeID = <cfqueryparam cfsqltype="cf_sql_integer" value="#val(getRegistrationDetails.ConferenceFeeType)#">

... trying that ....

and that solved the problem, and I understand why it solved the problem.

Thank you for helping me think my way through that.

Now to see if authorize.net will accept the gateway fingerprint from this test page; that was another problem before. I'm doing some more testing and will come back here soon.

Hope you are well and surviving the next blizzard up there. =) Thank you so much.

Eric
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
gdemaria and _agx_,

It's working really well, and it makes sense to me.

I have a security concern. When I submit the registration form, then the edit template does its work; then the confirmation page displays -- including a big green button that people can click to edit their registration.

The registerID displays in the URL. Anyone can edit url.registerID and can then edit someone else's registration record.

So, I am thinking that I should use a "mask" or cover like HideEdit.cfm, with this simple code:

HideEdit.cfm
<cfinclude template="/editRegistrants.cfm">

Open in new window


EditRegistrants.cfm can do its insert or update, and then do its relocation like this:

   </cfif>   <!---- end if ID exists do update or insert ---->
     
<!--- when finished? relocate --->
<cflocation url="/HideEdit.cfm">

<!--- END form.doSave --->
         </cfif>

Open in new window


... except, how would I tell HideEdit.cfm which record to edit?

Thank you again for your help. =) Making lots of progress.

Eric
0
 
LVL 39

Assisted Solution

by:gdemaria
gdemaria earned 461 total points
Comment Utility
I'm not understanding the use of HideEdit.cfm ,  it seems like you would just be changing the name of the confirmation page, how does that help?   As you say, you still need to get the ID to that page.   You can send the ID to the confirmation page (or the edit page) using form post, but that only helps keep it off the URL, it is still just a simple ID that can be guessed.   Here are some options:

A) you can encrypt the ID and pass it encrypted, then decrypt it on the form
B) you can hash the ID and pass it with the ID, then check that both values are present and match
C) you can create a long unique key (say from the hash of the ID) and save that in the database too, then you can use this long, non-guessable key to bring up the record instead of the short simple, sequential ID
0
 
LVL 3

Author Comment

by:Eric Bourland
Comment Utility
gdemaria, that makes sense. I think it is also starting to branch into another question. I'm going to do some research on this. I really appreciate all of your help, as always. Hope you are well.

Eric
0
 
LVL 3

Author Closing Comment

by:Eric Bourland
Comment Utility
Working really well. Thank you as always to gdemaria, _agx_, and randhawa. The client seems pretty pleased with the result.

Hope you all are having a great day. Take care.

Eric
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article  is about submitting  form through  ColdFusion.Ajax.submitForm to the action page and send a response back in JSON format which later can be decoded using ColdFusion.JSON.decode. By this way you can avoid the usual page refresh for subm…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now