Resubmitting a form

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.

Yours,
<><
Dancer
Dancer42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

anandkpCommented:
can we have a look at ur code pls ?
0
Dancer42Author Commented:
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">
<html>
<head>
<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">
</head>
<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>

<body>
<cfif (trim(degrees) is "") AND (trim(school) is "") AND (trim(certification) is "") AND (trim(statelicenses) is "") AND (trim(qualifications) is "")>
      <cfset nEducations = "0">
      <cfelse>
      <cfset nEducations = "1">
</cfif>
<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">
      <cfelse>
      <cfset nMandatories = "1">
</cfif>
<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#
</cfmail>
</cfif>

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

        <span class="goback">The following mandatory fields are missing:</span><br/>
        <br/>
<table width="526" border="0" cellpadding="12" cellspacing="0" bgcolor="#F2F2FF" class="body">
          <tr>
            <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>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <td class="body"><strong>* Educational Background</strong></td>
            <td>
                  <cfif nEducations is "0">
                  At least one of the Educational Background fields must be filled<br/>
                  </cfif>
                  <table width="100%" border="0" cellpadding="3" cellspacing="0" class="body">
                  <cfif nEducations is "0">
                <tr>
                  <td width="35%" height="27">Degrees</td>
                  <td width="65%"><cfinput name="degrees" type="text" size="40" required="no"></td>
                </tr>
                <tr>
                  <td>School</td>
                  <td><cfinput name="school" type="text" size="40" required="no"></td>
                </tr>
                <tr>
                  <td>National certification</td>
                  <td><cfinput name="certification" type="text" size="40" required="no"></td>
                </tr>
                <tr>
                  <td>State licenses</td>
                  <td><cfinput name="statelicenses" type="text" size="40" required="no"></td>
                </tr>
                <tr>
                  <td>Other qualifications</td>
                  <td><cfinput name="qualifications" type="text" size="40" required="no"></td>
                </tr>
                        <cfelse>
                        <cfoutput>
                        <cfif trim(degrees) is not "">
                <tr>
                  <td width="35%" height="27">Degrees</td>
                  <td width="65%">#degrees#</td>
                </tr>
                        </cfif>
                        <cfif trim(school) is not "">
                        <tr>
                  <td>School</td>
                  <td>#school#</td>
                </tr>
                        </cfif>
                        <cfif trim(certification) is not "">
                        <tr>
                  <td>National certification</td>
                  <td>#certification#</td>
                </tr>
                        </cfif>
                        <cfif trim(statelicenses) is not "">
                        <tr>
                  <td>State licenses</td>
                  <td>#statelicenses#</td>
                </tr>
                        </cfif>
                        <cfif trim(qualifications) is not "">
                        <tr>
                  <td>Other qualifications</td>
                  <td>#qualifications#</td>
                </tr>
                        </cfif>
                        </cfoutput>
                        </cfif>
              </table></td>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <td class="body"><strong>* Are you legally authorized to work in the
              U.S.?</strong></td>
            <td><cfif ParameterExists(legal)><cfif trim(legal) is "Yes">Yes<cfelse>No</cfif>
                  <cfelse>
                  <cfinput name="legal" type="radio" value="Yes">
              yes
              <cfinput name="legal" type="radio" value="No">
              no
                    </cfif></td>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <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>
          </tr>
          <tr>
            <td> <br/>
              <input type="submit" name="Submit" value="Submit"></td>
            <td>&nbsp;</td>
          </tr>
           </table>
        <span class="goback"><strong>Please fill in the missing information...</strong></span>
</td>
  </tr>
</table>

<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>
      
</cfif>
</cfform>
<div align="center"><br/>
</div>
</body>
</html>
0
Dancer42Author Commented:
oh, and before sending the email, the cfif is not:

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

but

</cfif>
<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.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

anandkpCommented:
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)>
#listgetat(cookie.mycommoncookie,1,'~')#
#listgetat(cookie.mycommoncookie,2,'~')#
</cfif>

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

hth

K'Rgds
Anand
0
Dancer42Author Commented:
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)?
0
anandkpCommented:
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  !
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jyokumCommented:
just a side note... don't use ParameterExists(), it's been deprecated. use isDefined() instead

<cfif ParameterExists(fulltime)>

becomes

<cfif isDefined('fulltime')>
0
Dancer42Author Commented:
Thanks anandkp, and thanks for the comment jyokum
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.