You Forgot to enter your name!"> Your Email Address seems incorrect?"> You Forgot to enter a comment!">

You have some errors in your form submission, please try again
#errors#

Name:

Country:

City:

Telephone:

E-mail:

Comments:

Booking dates:

From:

To:

[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Hydrowizard [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> You Forgot to enter your name!"> Your Email Address seems incorrect?"> You Forgot to enter a comment!">

You have some errors in your form submission, please try again
#errors#

Name:

Country:

City:

Telephone:

E-mail:

Secret word:

Please retype the Secret Word in the field below. This is a simple security matter to protect the information we receive through this form.

Comments:

Booking dates:

From:

To:

PLEASE CHECK EMAIL

[allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => Hydrowizard [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 3 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> <cfif form.secret_word EQ #session.secretWord#> thankyou <cfelse>sorry </cfif> - Coldfusion - Getting Started

<cfif form.secret_word EQ #session.secretWord#> thankyou <cfelse>sorry </cfif> - Coldfusion - Getting Started

If users enter the secret_word which coincides with the session.secretWord then the form can continue and do its validating. If not the form stops and the cfelse message is shown. The cfif code is here: <cfif form.secret_word EQ #session.secretWord#> Thank you for your message. <cfelse> Sorry, the secret word you entered in the field does not match the word in the image Please hit your back button</cfif> My actionpage is here and I would be very greatful if someone could show me where the cfif should go. Thanks: <cfinclude template="topnav.cfm"> <!--- Must create this default structure or we pull an ...

Sponsored Links
  1. #1

    Default <cfif form.secret_word EQ #session.secretWord#> thankyou <cfelse>sorry </cfif>

    If users enter the secret_word which coincides with the session.secretWord then
    the form can continue and do its validating. If not the form stops and the
    cfelse message is shown. The cfif code is here:
    <cfif form.secret_word EQ #session.secretWord#>
    Thank you for your message.
    <cfelse>
    Sorry, the secret word you entered in the field does not match the word in the
    image
    Please hit your back button</cfif>


    My actionpage is here and I would be very greatful if someone could show me
    where the cfif should go. Thanks:

    <cfinclude template="topnav.cfm">
    <!--- Must create this default structure or we pull an error --->
    <cfparam name="session.contact_nfo" default="">
    <cfif NOT IsStruct(session.contact_nfo)>
    <cfset session.contact_nfo = StructNew()>
    </cfif>

    <!-- Now we create default variable using cfparam -->
    <cfparam name="Form.terms" default="NO">
    <cfparam name="session.contact_nfo.Name" default="">
    <cfparam name="Form.Country" default="">
    <cfparam name="Form.City" default="">
    <cfparam name="Form.Telephone" default="">
    <cfparam name="session.contact_nfo.email" default="">
    <cfparam name="session.contact_nfo.comments" default="">

    <!-- Now we clear the Session of any Values to allow us to place our new form
    Values passed from our form page -->
    <cfset StructClear(session.contact_nfo)>
    <!-- Now we are placing our Form Values into the Session -->
    <cfset session.contact_nfo.terms= form.terms>
    <cfset session.contact_nfo.Name= form.Name>
    <cfset session.contact_nfo.email= form.email>
    <cfset session.contact_nfo.comments= form.comments>

    <!-- Now we are going to do our Error Checking first off by creating a value
    of nothing for the variable we are calling Errors -->
    <cfparam name="errors" type="string" default="">
    <!-- As we check for Errors if we find one we place it in our List to display
    to our user making it easy for the end-user to correct as they can see the
    error -->
    <!-- Notice we are not validating the checkbox as it is not a required form
    field -->
    <cfif form.Name EQ "">
    <cfset errors = errors & "<li>You Forgot to enter your name!</li>">
    </cfif>

    <!-- Checking the email is a little more complicated so we use a regular
    expression to check and see if there is a email address and also is it formed
    properly -->
    <cfif NOT REFindnocase("^+(+\.)+{2,6}$", email)>
    <cfset errors = errors & "<li class=""errors"">Your Email Address
    seems incorrect?</li>">
    </cfif>

    <cfif form.comments EQ "">
    <cfset errors = errors & "<li class=""errors"">You Forgot to enter
    a comment!</li>">
    </cfif>

    <cfif errors NEQ "">
    <!-- Here we are collecting the Error Message generated by our code and
    placing them into a list for the user to see -->
    <TABLE class="label1" WIDTH="300" BORDER="0" CELLSPACING="0" CELLPADDING="0"
    ALIGN="Center">
    <TR><P> <TD ALIGN="Left" VALIGN="Top">You have some errors in your form
    submission, please try again<br>
    <cfoutput>#errors#</cfoutput></td></P>
    </tr>
    </table>
    <!-- Also take note that the form action is now different in that it is
    carrying the applications session with it which we need to make our
    Application.cfm file work with the action. -->
    <cfoutput>
    <form method="post" action="action_form.cfm?#session.UrlToken#">
    <P><TABLE class="label1" WIDTH="300" BORDER="0" CELLSPACING="0"
    CELLPADDING="0" ALIGN="Center">

    <TR> <TD ALIGN="Left" VALIGN="Top">
    <!-- This is how we place our session values into the form field also
    important to note the because we used cfparam in the start of this page to
    assign a default value of "" if there was no value originally entered in the
    form than it will show no value here. If we did not use the cfparam tag we
    would now show an error as the session would go looking for a non-existant
    value -->
    <P>Name: <br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Name" SIZE="40"
    value="#session.contact_nfo.Name#"></P>
    <P>Country:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Country" SIZE="40"
    value="#Form.Country#"></P>
    <P>City:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="City" SIZE="40"
    value="#Form.City#"></P>
    <P>Telephone:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Telephone" SIZE="40"
    value="#Form.Telephone#"></P>
    <P>E-mail: <br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Email" SIZE="40"
    value="#session.contact_nfo.email#"></P>
    </P>

    <P>Comments: <BR>
    <textarea cols="40" size="40" class="ftforminputsmall" rows="2"
    name="comments">#session.contact_nfo.comments#</textarea></P>
    <P>Booking dates:<br>
    <P>From:
    <select name="day" class="ftforminputsmall">
    <cfloop from="1" to="31" index="i">
    <option value="#i#" selected="selected">#form.day#</option>
    </cfloop>
    </select>
    <cfset monthList =
    "January,February,March,April,May,June,July,August ,September,October,November,De
    cember" />
    <select name="month" class="ftforminputsmall">
    <cfloop list="#monthList#" index="m"> <option value="#m#"
    selected="selected">#form.month#</option></cfloop> </select>
    <select name="year" class="ftforminputsmall">
    <cfloop from="2006" to="2020" index="i">
    <option value="#i#">#form.year#</option>
    </cfloop>
    </select>
    </P>
    <P>To:
    <select name="dayto" class="ftforminputsmall">
    <cfloop from="1" to="31" index="i">
    <option value="#i#" selected="selected">#form.dayto#</option>
    </cfloop>
    </select>
    <cfset monthList =
    "January,February,March,April,May,June,July,August ,September,October,November,De
    cember" />
    <select name="monthto" class="ftforminputsmall">
    <cfloop list="#monthList#" index="m"> <option value="#m#"
    selected="selected">#form.monthto#</option></cfloop> </select>
    <select name="yearto" class="ftforminputsmall">
    <cfloop from="2006" to="2020" index="i">
    <option value="#i#" selected="selected">#form.yearto#</option>
    </cfloop>
    </select>
    <P>
    <input name="Submit" type="submit" CLASS="ftforminputsmall"
    value="Submit">
    </P>
    </table>
    </form>
    </cfoutput>
    <!-- If no errors were detected we abort the previous code and show the next
    code section -->
    <cfabort>
    </cfif></td></tr>



    Sponsored Links
    Hydrowizard Guest

  2. #2

    Default Re: <cfif form.secret_word EQ #session.secretWord#>thank you <cfelse>sorry </cfif>

    As close to the top as possible - right after the cfinclude.

    However, make sure it is defined first or your code will crash.


    Dan Guest

  3. #3

    Default Re: <cfif form.secret_word EQ #session.secretWord#>thank you <cfelse>sorry </cfif>

    Right I?ve put in the cfparams and the cfif at the top of the page after the
    cfinclude.
    However if the word is wrong the page still executes which it shouldn?t. It is
    confusing with all the cfifs but if the secret word is wrong the "sorry"
    message should be shown and the page stops (maybe I need cfabort or cfexit?)
    The message is being shown but the page continues. Here is the code:

    <cfinclude template="topnav.cfm">
    <cfparam name="session.secretWord" default="">
    <cfparam name="Form.secret_word" default="">
    <cfif form.secret_word EQ #session.secretWord#>
    Thank you for your message.
    <cfelse>
    Sorry, the secret word you entered in the field does not match the word in the
    image
    Please hit your back button</cfif>

    <!--- Must create this default structure or we pull an error --->
    <cfparam name="session.contact_nfo" default="">
    <cfif NOT IsStruct(session.contact_nfo)>
    <cfset session.contact_nfo = StructNew()>
    </cfif>

    <!-- Now we create default variable using cfparam -->
    <cfparam name="Form.terms" default="NO">
    <cfparam name="session.contact_nfo.Name" default="">
    <cfparam name="Form.Country" default="">
    <cfparam name="Form.City" default="">
    <cfparam name="Form.Telephone" default="">
    <cfparam name="session.contact_nfo.email" default="">
    <cfparam name="session.contact_nfo.comments" default="">

    <!-- Now we clear the Session of any Values to allow us to place our new form
    Values passed from our form page -->
    <cfset StructClear(session.contact_nfo)>
    <!-- Now we are placing our Form Values into the Session -->
    <cfset session.contact_nfo.terms= form.terms>
    <cfset session.contact_nfo.Name= form.Name>
    <cfset session.contact_nfo.email= form.email>
    <cfset session.contact_nfo.comments= form.comments>

    <cfparam name="errors" type="string" default="">
    <cfif form.Name EQ "">
    <cfset errors = errors & "<li>You Forgot to enter your name!</li>">
    </cfif>

    <cfif NOT REFindnocase("^+(+\.)+{2,6}$", email)>
    <cfset errors = errors & "<li class=""errors"">Your Email Address
    seems incorrect?</li>">
    </cfif>

    <cfif form.comments EQ "">
    <cfset errors = errors & "<li class=""errors"">You Forgot to enter
    a comment!</li>">
    </cfif>


    <cfif errors NEQ "">
    <!-- Here we are collecting the Error Message generated by our code and
    placing them into a list for the user to see -->
    <TABLE class="label1" WIDTH="300" BORDER="0" CELLSPACING="0" CELLPADDING="0"
    ALIGN="Center">
    <TR><P> <TD ALIGN="Left" VALIGN="Top">You have some errors in your form
    submission, please try again<br>
    <cfoutput>#errors#</cfoutput></td></P>
    </tr>
    </table>
    <!-- basically the same form we used in form.cfm -->
    <cfoutput>
    <form method="post" action="action_form.cfm?#session.UrlToken#">
    <P><TABLE class="label1" WIDTH="300" BORDER="0" CELLSPACING="0"
    CELLPADDING="0" ALIGN="Center">

    <TR> <TD ALIGN="Left" VALIGN="Top">
    <P>Name: <br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Name" SIZE="40"
    value="#session.contact_nfo.Name#"></P>
    <P>Country:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Country" SIZE="40"
    value="#Form.Country#"></P>
    <P>City:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="City" SIZE="40"
    value="#Form.City#"></P>
    <P>Telephone:<br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Telephone" SIZE="40"
    value="#Form.Telephone#"></P>
    <P>E-mail: <br>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="Email" SIZE="40"
    value="#session.contact_nfo.email#"></P>
    </P>
    <P>Secret word: <br>
    <cfinvoke webservice="http://www.easycfm.com/webservices/captcha.cfc?wsdl"
    method="generateCaptcha"
    returnvariable="easyCaptcha">
    <cfinvokeargument name="height" value="100"/>
    <cfinvokeargument name="YPos" value="20"/>
    </cfinvoke> </P>

    <P><cfset session.secretWord = easyCaptcha.CAPTCHAWORD>
    <cfoutput>
    <img src="#easyCaptcha.IMAGE#" border="0"></cfoutput></P>

    <P><div="label1"> Please retype the Secret Word in the field below. This is a
    simple security
    matter to protect the information we receive through this form.</div></P>

    <P>
    <INPUT TYPE="Text" class="ftforminputsmall" NAME="secret_word" SIZE="40"></P>





    <P>Comments: <BR>
    <textarea cols="40" size="40" class="ftforminputsmall" rows="2"
    name="comments">#session.contact_nfo.comments#</textarea></P>
    <P>Booking dates:<br>
    <P>From:
    <select name="day" class="ftforminputsmall">
    <cfloop from="1" to="31" index="i">
    <option value="#i#" selected="selected">#form.day#</option>
    </cfloop>
    </select>
    <cfset monthList =
    "January,February,March,April,May,June,July,August ,September,October,November,De
    cember" />
    <select name="month" class="ftforminputsmall">
    <cfloop list="#monthList#" index="m"> <option value="#m#"
    selected="selected">#form.month#</option></cfloop> </select>
    <select name="year" class="ftforminputsmall">
    <cfloop from="2006" to="2020" index="i">
    <option value="#i#">#form.year#</option>
    </cfloop>
    </select>
    </P>
    <P>To:
    <select name="dayto" class="ftforminputsmall">
    <cfloop from="1" to="31" index="i">
    <option value="#i#" selected="selected">#form.dayto#</option>
    </cfloop>
    </select>
    <cfset monthList =
    "January,February,March,April,May,June,July,August ,September,October,November,De
    cember" />
    <select name="monthto" class="ftforminputsmall">
    <cfloop list="#monthList#" index="m"> <option value="#m#"
    selected="selected">#form.monthto#</option></cfloop> </select>
    <select name="yearto" class="ftforminputsmall">
    <cfloop from="2006" to="2020" index="i">
    <option value="#i#" selected="selected">#form.yearto#</option>
    </cfloop>
    </select>
    <P>
    <input name="Submit" type="submit" CLASS="ftforminputsmall"
    value="Submit">
    </P>
    </table>
    </form>
    </cfoutput>
    <!-- If no errors were detected we abort the previous code and show the next
    code section -->
    <cfabort>
    </cfif></td></tr>

    <!-- In this next section we can now take our form values and do what ever we
    decide to do with them i.e. mailing them to ourselves, placing them into a
    database, or a combination of both. In this section it is wise to let the user
    know that his information has been received as coldfusion has no way of letting
    them know ---->

    <cfmail server="" username="" password="" to="" from="" subject="" type="">
    <table><tr>
    <td align="center" bgcolor="##006600" class="ftbody"><span
    class="ftbody2"><strong class="label1">Telephone: </strong></span></td>
    <td align="center" bgcolor="##006600" class="ftbody"><span
    class="ftbody2"><strong
    class="label1"><cfoutput>#Trim(FORM.name)#</cfoutput></strong></span></td>
    </tr></cfmail>
    <p>PLEASE CHECK EMAIL</p>

    Hydrowizard Guest

  4. #4

    Default Re: <cfif form.secret_word EQ #session.secretWord#>thank you <cfelse>sorry </cfif>

    At what point do you set session.secretword?
    Dan Guest

  5. #5

    Default Re: <cfif form.secret_word EQ #session.secretWord#>thank you <cfelse>sorry </cfif>

    Thanks Dan it works now I was just getting confused about cfifs
    Hydrowizard Guest

Similar Threads

  1. Element SECRETWORD is undefined in SESSION
    By Hydrowizard in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: April 8th, 01:40 PM
  2. CFIF is being ignored
    By KimMazz in forum Coldfusion Database Access
    Replies: 3
    Last Post: March 20th, 10:43 PM
  3. Contribute and <cfif><cfelse> statements
    By wendigo in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: August 17th, 02:08 PM
  4. CFIF help
    By rere in forum Coldfusion - Getting Started
    Replies: 1
    Last Post: August 1st, 05:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Telephone: #Trim(FORM.name)#