Solved

Resubmitting a form

Posted on 2003-12-09
8
263 Views
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.

Yours,
<><
Dancer
0
Comment
Question by:Dancer42
  • 4
  • 3
8 Comments
 
LVL 17

Expert Comment

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

Author Comment

by:Dancer42
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">
<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
 

Author Comment

by:Dancer42
ID: 9909851
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 17

Expert Comment

by:anandkp
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)>
#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
 

Author Comment

by:Dancer42
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)?
0
 
LVL 17

Accepted Solution

by:
anandkp earned 140 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  !
0
 
LVL 12

Expert Comment

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

<cfif ParameterExists(fulltime)>

becomes

<cfif isDefined('fulltime')>
0
 

Author Comment

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

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

12 Experts available now in Live!

Get 1:1 Help Now