Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Resubmitting a form

Posted on 2003-12-09
Medium Priority
Last Modified: 2013-12-24
I have a form that should send an email,
If one of the mandatory fields is not filled, it doesn't send the email, but asks for the missing fields and then submits the changes to itself.
In order to "keep alive" the variables not resubmitted, I create a cookie for the variables using cfcookie tag.

I have two such forms, and it seems like one is working, but on the other, on resubmitting, it doesn't recognize the fields that were originally submitted.

Question by:Dancer42
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 17

Expert Comment

ID: 9909797
can we have a look at ur code pls ?

Author Comment

ID: 9909832
There a big chunk of it, but here it is (First time this form is submited by anouther form, where all of the variables are initially created, so there's no error on the first time this loads, error is on ly abter resubmittal):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>Therapist Information Request Submitted</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="cortiva.css" rel="stylesheet" type="text/css">
<cfparam name="nEducations"  default="1">
<cfparam name="nMandatories"  default="1">

<cfcookie name="firstname" value="#firstname#" expires="never">
<cfcookie name="lastname" value="#lastname#" expires="never">
<cfcookie name="degrees" value="#degrees#" expires="never">
<cfcookie name="school" value="#school#" expires="never">
<cfcookie name="certification" value="#certification#" expires="never">
<cfcookie name="statelicenses" value="#statelicenses#" expires="never">
<cfcookie name="qualifications" value="#qualifications#" expires="never">
<cfcookie name="city" value="#city#" expires="never">
<cfcookie name="state" value="#state#" expires="never">
<cfcookie name="telephone" value="#telephone#" expires="never">
<cfcookie name="email" value="#email#" expires="never">
<cfcookie name="address" value="#address#" expires="never">
<cfcookie name="weburl" value="#weburl#" expires="never">
<cfcookie name="college" value="#college#" expires="never">
<cfcookie name="massagetechs" value="#massagetechs#" expires="never">
<cfcookie name="additionalhours" value="#additionalhours#" expires="never">
<cfcookie name="happytotravel" value="#happytotravel#" expires="never">
<cfcookie name="howdidyoufindus" value="#howdidyoufindus#" expires="never">
<cfcookie name="stateslicensed" value="#stateslicensed#" expires="never">
<cfif ParameterExists(fulltime)><cfcookie name="fulltime" value="#fulltime#" expires="never"></cfif>
<cfif ParameterExists(parttime)><cfcookie name="parttime" value="#parttime#" expires="never"></cfif>
<cfif ParameterExists(private)><cfcookie name="private" value="#private#" expires="never"></cfif>
<cfif ParameterExists(normalhours)><cfcookie name="normalhours" value="#normalhours#" expires="never"></cfif>
<cfif ParameterExists(mornings)><cfcookie name="mornings" value="#mornings#" expires="never"></cfif>
<cfif ParameterExists(evenings)><cfcookie name="evenings" value="#evenings#" expires="never"></cfif>
<cfif ParameterExists(afterhours)><cfcookie name="afterhours" value="#afterhours#" expires="never"></cfif>
<cfif ParameterExists(weekends)><cfcookie name="weekends" value="#weekends#" expires="never"></cfif>
<cfif ParameterExists(legal)><cfcookie name="legal" value="#legal#" expires="never"></cfif>

<cfif (trim(degrees) is "") AND (trim(school) is "") AND (trim(certification) is "") AND (trim(statelicenses) is "") AND (trim(qualifications) is "")>
      <cfset nEducations = "0">
      <cfset nEducations = "1">
<cfif trim(email) is "" OR trim(firstname) is "" OR trim(lastname) is "" OR trim(yearsexp) is "" OR trim(city) is "" OR trim(state) is "" OR trim(telephone) is "" OR nEducations is "0">
      <cfset nMandatories = "0">
      <cfset nMandatories = "1">
<cfif trim(nMandatories) is "0">
<cfmail from="#email#" to="somewhere@over.rainbow" server="mail.fairytails.org" subject="Therapist Information Request">
Date: #Dateformat(Now(), "mmmm d, yyyy")# #Timeformat(Now(), "h:mm tt")#
First Name: #firstname#
Last Name: #lastname#

Educational Background:
Degrees: #degrees#
School: #school#
National certification: #certification#
State licenses: #statelicenses#
Other qualifications: #qualifications#

Number of Years Experience: #yearsexp#

City: #city#
State: #state#
Email Address: #email#
Telephone number: #telephone#

Legally authorized to work in the U.S.?: <cfif ParameterExists(legal)><cfif trim(legal) is "Yes">Yes<cfelse>No</cfif></cfif>
States in which you are licensed to work: #stateslicensed#

Address: #address#
URL: #weburl#
College Attended: #college#
Massage techniques you are qualified to perform: #massagetechs#

Are you currently employed?
Fulltime: <cfif ParameterExists(fulltime)>#fulltime#<cfelse>No</cfif>
Part time: <cfif ParameterExists(parttime)>#parttime#<cfelse>No</cfif>
Private practice: <cfif ParameterExists(private)>#private#<cfelse>No</cfif>

Number of Hours or Additional Hours You Would Like to Work Each Week: #additionalhours#

Preferred Times of Work:
Normal working huors: <cfif ParameterExists(normalhours)>#normalhours#<cfelse>No</cfif>
Mornings only: <cfif ParameterExists(mornings)>#mornings#<cfelse>No</cfif>
Evenings only: <cfif ParameterExists(evenings)>#evenings#<cfelse>No</cfif>
After hours: <cfif ParameterExists(afterhours)>#afterhours#<cfelse>No</cfif>
Weekends: <cfif ParameterExists(weekends)>#weekends#<cfelse>No</cfif>

Happy to Travel (Cruise Line work, etc.): #happytotravel#
How did you find us?  #howdidyoufindus#

<cfform action="TIREmail2.cfm">
<cfif trim(nMandatories) is "0">

        <span class="goback">The following mandatory fields are missing:</span><br/>
<table width="526" border="0" cellpadding="12" cellspacing="0" bgcolor="#F2F2FF" class="body">
            <td width="25%" class="body"><strong>* First Name</strong></td>
            <td width="75%"><cfif trim(firstname) is ""><cfinput name="firstname" type="text" size="40" required="no"><cfelse><cfoutput>#firstname#</cfoutput></cfif></td>
            <td class="body"><strong>* Last Name</strong></td>
            <td><cfif trim(lastname) is ""><cfinput name="lastname" type="text" size="40" required="no"><cfelse><cfoutput>#lastname#</cfoutput></cfif></td>
            <td class="body"><strong>* Educational Background</strong></td>
                  <cfif nEducations is "0">
                  At least one of the Educational Background fields must be filled<br/>
                  <table width="100%" border="0" cellpadding="3" cellspacing="0" class="body">
                  <cfif nEducations is "0">
                  <td width="35%" height="27">Degrees</td>
                  <td width="65%"><cfinput name="degrees" type="text" size="40" required="no"></td>
                  <td><cfinput name="school" type="text" size="40" required="no"></td>
                  <td>National certification</td>
                  <td><cfinput name="certification" type="text" size="40" required="no"></td>
                  <td>State licenses</td>
                  <td><cfinput name="statelicenses" type="text" size="40" required="no"></td>
                  <td>Other qualifications</td>
                  <td><cfinput name="qualifications" type="text" size="40" required="no"></td>
                        <cfif trim(degrees) is not "">
                  <td width="35%" height="27">Degrees</td>
                  <td width="65%">#degrees#</td>
                        <cfif trim(school) is not "">
                        <cfif trim(certification) is not "">
                  <td>National certification</td>
                        <cfif trim(statelicenses) is not "">
                  <td>State licenses</td>
                        <cfif trim(qualifications) is not "">
                  <td>Other qualifications</td>
            <td class="body"><strong>* Number of Years Experience</strong></td>
            <td><cfif trim(yearsexp) is ""><cfinput name="yearsexp" type="text" size="10" required="no"><cfelse><cfoutput>#yearsexp#</cfoutput></cfif></td>
            <td class="body"><strong>* Are you legally authorized to work in the
            <td><cfif ParameterExists(legal)><cfif trim(legal) is "Yes">Yes<cfelse>No</cfif>
                  <cfinput name="legal" type="radio" value="Yes">
              <cfinput name="legal" type="radio" value="No">
            <td class="body"><strong>* States in which you are licensed to work</strong></td>
            <td><cfif trim(stateslicensed) is ""><cfinput name="stateslicensed" type="text" value="" size="50"><cfelse><cfoutput>#stateslicensed#</cfoutput></cfif></td>
            <td class="body"><strong>* City</strong></td>
            <td><cfif trim(city) is ""><cfinput name="city" type="text" size="40" required="no"><cfelse><cfoutput>#city#</cfoutput></cfif></td>
            <td class="body"><strong>* State</strong></td>
            <td><cfif trim(state) is ""><cfinput name="state" type="text" size="40" required="no"><cfelse><cfoutput>#state#</cfoutput></cfif></td>
            <td class="body"><strong>* Email Address</strong></td>
            <td><cfif trim(email) is ""><cfinput name="email" type="text" size="40" required="no"><cfelse><cfoutput>#email#</cfoutput></cfif></td>
            <td class="body"><strong>* Telephone Number</strong></td>
            <td><cfif trim(telephone) is ""><cfinput name="telephone" type="text" size="30" required="no"><cfelse><cfoutput>#telephone#</cfoutput></cfif></td>
            <td> <br/>
              <input type="submit" name="Submit" value="Submit"></td>
        <span class="goback"><strong>Please fill in the missing information...</strong></span>

<cfelse> <!-- Mandatories is not 0 -->
  <div align="center"><span class="title"><strong>Thank you for submitting the information...</strong> </span> </div>
<cfcookie name="firstname" expires="now">
<cfcookie name="lastname" expires="now">
<cfcookie name="degrees" expires="now">
<cfcookie name="school" expires="now">
<cfcookie name="certification" expires="now">
<cfcookie name="statelicenses" expires="now">
<cfcookie name="qualifications" expires="now">
<cfcookie name="city" expires="now">
<cfcookie name="state" expires="now">
<cfcookie name="telephone" expires="now">
<cfcookie name="email" expires="now">
<cfcookie name="address" expires="now">
<cfcookie name="weburl" expires="now">
<cfcookie name="college" expires="now">
<cfcookie name="massagetechs" expires="now">
<cfcookie name="additionalhours" expires="now">
<cfcookie name="happytotravel" expires="now">
<cfcookie name="howdidyoufindus" expires="now">
<cfcookie name="stateslicensed" expires="now">
<cfif ParameterExists(fulltime)><cfcookie name="fulltime" expires="now"></cfif>
<cfif ParameterExists(parttime)><cfcookie name="parttime" expires="now"></cfif>
<cfif ParameterExists(private)><cfcookie name="private" expires="now"></cfif>
<cfif ParameterExists(normalhours)><cfcookie name="normalhours" expires="now"></cfif>
<cfif ParameterExists(mornings)><cfcookie name="mornings" expires="now"></cfif>
<cfif ParameterExists(evenings)><cfcookie name="evenings" expires="now"></cfif>
<cfif ParameterExists(afterhours)><cfcookie name="afterhours" expires="now"></cfif>
<cfif ParameterExists(weekends)><cfcookie name="weekends" expires="now"></cfif>
<cfif ParameterExists(legal)><cfcookie name="legal" expires="now"></cfif>
<div align="center"><br/>

Author Comment

ID: 9909851
oh, and before sending the email, the cfif is not:

<cfif trim(nMandatories) is "0">
<cfmail from="#email#" to="somewhere@over.rainbow" server="mail.fairytails.org" subject="Therapist Information Request">


<cfif trim(nMandatories) is not "0">
<cfmail from="#email#" to="somewhere@over.rainbow" server="mail.fairytails.org" subject="Therapist Information Request">

I removed the not for debugging reasons.
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

LVL 17

Expert Comment

ID: 9909912
U shldnt be creating so many cookies in the first place !

also i dont see the value set in the cookie

ur cookie shld be created like this

<CFCOOKIE NAME="MyCommonCookie" VALUE="Anand~Dancer">
Create one cookie & have teh elements taken in as a list

u can then read the elements from this as

<cfif isdefined(cookie.mycommoncookie)>

Also ... if ur resubmitting the form - i dont understand - why u wont get all teh values submitted initially !



Author Comment

ID: 9909935
First form has alot of information submitted, on the second, only the mandatory fields are taken.

Is there another way to do this (other then using a cookie)?
LVL 17

Accepted Solution

anandkp earned 420 total points
ID: 9909978
u cld use whatever ur comfortable with

session / cookies / form variables

best wld be to resubmit the values as form variables - to keep them alive

cookie also is not a bad idea - but dont create too many cookies - one shld suffice  !
LVL 12

Expert Comment

ID: 9910025
just a side note... don't use ParameterExists(), it's been deprecated. use isDefined() instead

<cfif ParameterExists(fulltime)>


<cfif isDefined('fulltime')>

Author Comment

ID: 9910049
Thanks anandkp, and thanks for the comment jyokum

Featured Post

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

618 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