Solved

dynamic check box variables

Posted on 2004-04-18
28
308 Views
Last Modified: 2013-12-24
I am dynamically creating input checkboxes with the following query:
<cfquery name="getModels1" datasource="#DSN#" username="#UN#" password="#PW#">
SELECT tblModel.Model_id, tblModel.Model, tbl.Model.Comp_id, tblCompanies.Comp_id, tblModel.BitValue, tblCompanies.CompName
FROM tblModel,tblCompanies
WHERE tblModel.Comp_id = 1 and tblCompanies.Comp_id = 1
</cfquery>
<cfoutput query="getModels1">
<input type="checkbox" name="yachts" value="#Model#">#Model#<br></cfoutput>

I want to use the submitted variables in a cfmail to display the requested yacht model information. I have tried numerous methods including #evaluate(form.yachts)# and the other examples found here as well as Macromedia's "Developing Cold Fusion Applications". I have tried ListQualify, list loops ect and it is just a complete nightmare for me. I just can't seem to pass the list of variables. I have tried to set the cfparam  default="no" and even tried to dynamically give the cfparam a value. I really could use some Expert advice.

Thanks,
Reba
0
Comment
Question by:MsReba
  • 14
  • 11
  • 3
28 Comments
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10855123
Are you aware that checkboxes do not pass a value to the submitted page if they are not checked?

You do not need evaluate for the way you have it setup #form.yachts# will work if you actually check the box.

If you tick more than one checkbox you should be presented with a list of values, if there is only one box ticked then you should receive a simple string value.

Where exactly do you run into problems?
0
 

Author Comment

by:MsReba
ID: 10855161
Yes, I am aware checkboxes donot pass a value unless they are checked. This code on the processing page:

<cfparam name="yachts" default="no">

<cfif isDefined("form.yachts")>
            <cfloop list="#Form.yachts#" index="i">
            <cfoutput>#i#<br></cfoutput>
            </cfloop>
                  
            </cfif>

gives me this error:
"The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values."

I have even tried it without the cfloop list.

0
 

Author Comment

by:MsReba
ID: 10855226
Am I correct in my understanding of html checkboxes that I can give several checkboxes the same "name" but just give them each a different string value?

<input type="checkbox" name="yachts" value="Model 280">
<input type="checkbox" name="yachts" value="Model 380>

That's what being dynamic is about and that is the code that is output to the browser.

and
When a form is submitted the form variables are sent to the processing page in a comma delimited list?

If so why will my isDefined not work in the loop? Wrong loop?

I get the same error even if I check every single box. Could it be that it won't work within the cfmail tag? and that I must hard code the variables? If so I would have to change the way I have my input boxes set up so that the input name would be different. Oh my god. I'm in such a pickle.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10855448
Yes,

So just do a <CFOUTPUT>#form.yachts#</CFOUTPUT> and see what it contains. Let us know.
0
 

Author Comment

by:MsReba
ID: 10855495
"The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values."

I swear it must have something to do with trying to pass the dynamic variables within a cfmail tag. What do you think?
I'm having a COW!
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10855513
Shouldn't.

If your on MX try doing a <CFDUMP Var="#Form#">

this will dump the entire contents of the form variable and you can see what's in there.

On the form page, what method are you using get or post? GET posts as URL variables and POST posts as FORM variables.
0
 

Author Comment

by:MsReba
ID: 10855768
<cfdump var="#form#"> -- it dumped "form.yacht"  (without the quotes of course)

I am posting for sure.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10855779
What value(s) did form.yacht show in the dump? Perhaps you could post your code.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10855786
The problem I think your having is that although form.yacht is defined, it has no values, thus the loop over an empty list fails.

If im right, then making this change will stop the error but not fix the problem.

<cfif isDefined("form.yachts") and ListLen(form.yachts)>

This will ensure that not only is the form variable defined, but also that it contains a list of gt 0 elements.
0
 

Author Comment

by:MsReba
ID: 10855871
No, I was wrong. I had another form.model. shame on me. I made the appropriate changes;
now the correct variables are dumped for each form field and each dynamic checkbox BUT they are not displayed in the email that is sent. I don't get any errors - but still not quite right.

Great suggestion Plucka. I had already tried dump but didnt' do something right. Now I at least know my variables are there. It's just a matter of getting the to output in the email.

This is what I used (among other things):
<cfloop index="i" from="0" to="12">
                  <cfif isDefined("form.Model")>
                  <cfoutput>#i#<br></cfoutput>
                  </cfif>
                  </cfloop>

I tried #form.Model# -- didn't work either.

need more help!
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10855897
Firstly,

Your original code is best and should work. Can you post the value contained in form.model so I know what i'm dealing with?

<cfif isDefined("form.model") and ListLen(form.model)>
      <cfloop index="i" list="#form.model#">
            <cfoutput>#i#<br /></cfoutput>
      </cfloop>
</cfif>

Here's my test code, not knowing what's in your variable

<cfset form.model = "new,old,shiny">

<cfif isDefined("form.model") and ListLen(form.model)>
      <cfloop index="i" list="#form.model#">
            <cfoutput>#i#<br /></cfoutput>
      </cfloop>
</cfif>

outputs

new
old
shiny
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10855944
Add the scope form to your param
<cfparam name="form.yachts" default="no">
0
 
LVL 17

Expert Comment

by:Tacobell777
ID: 10855952
PS. use
<cfloop index="item" list="#form.yacht#">
#variables.item#<br>
</cfloop>

instead of the from loop
0
 

Author Comment

by:MsReba
ID: 10855954

 
 
 
 

   
 
 

               

Thank you 444,
Your request has been sent to Northside Marine Yacht Sales. We will promptly process your request for the selected catalog of interest. We look for ward to assisting you in choosing the yacht of your dreams in the near future.
 
  Thank you,
  Jim Penix
Northside Marine Yacht Sales
 
struct
280 EXPRESS 280 Express
340 IO EXPRESS 340 IO Express
370 EXPRESS 370 Express
540 EXPRESS 540 Express
ADDRESS 4170 Alabama
ADDRESS_REQUIRED Please enter your address
CITY rtw
CITY_REQUIRED Please enter your city
EMAIL reba@cruzfla.com
EMAIL_REQUIRED Please enter your email address
FIELDNAMES NAME,ADDRESS,CITY,STATE,ZIP,PHONE,EMAIL,OWN,YOURMODEL,YEAR,SIZE,REFERREDBY,280 EXPRESS,340 IO EXPRESS,370 EXPRESS,540 EXPRESS,SUBMIT
NAME 444
NAME_REQUIRED Please enter your name
OWN yes
PHONE fdsg
REFERREDBY [empty string]
SIZE [empty string]
STATE AL
SUBMIT Submit
YEAR [empty string]
YOURMODEL [empty string]
ZIP gfdg
ZIP_REQUIRED Please enter your zip code
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Expert Comment

by:Plucka
ID: 10855986
Looks like your using YOURMODEL.

So use this variable instead, but it's empty so might be a problem in your form, assuming you ticked one of the boxes of course.

If you want

<cfset form.yourmodel = "new,old,shiny">

<cfif isDefined("form.yourmodel") and ListLen(form.yourmodel)>
     <cfloop index="i" list="#form.yourmodel#">
          <cfoutput>#i#<br /></cfoutput>
     </cfloop>
</cfif>

outputs

new
old
shiny

If you want to have a default value, then you can use cfparam

<cfparam name="form.yourmodel" default="no">

<cfloop index="i" list="#form.yourmodel#">
      <cfoutput>#i#<br /></cfoutput>
 </cfloop>

NOTE: You don't need the IsDefined or ListLen as there will always be a value.
0
 

Author Comment

by:MsReba
ID: 10856010
NO definitely no. yourmodel is a textbox form field.

I am giving the <input type=checkbox name=#Model# value=#Model#> dynamic values froma database. That's why you see all the yacht models in the FIELDNAMES above. That was actually copied from the <cfdump> which shows the "struct" table. The left column is fieldnames and the right are values.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856022
Well, that's your problem, should be.

<input type=checkbox name="Model" value="#Model#">

The name should be fixed.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856046
Actually, you had it right in your fist post.

<input type="checkbox" name="yachts" value="#Model#">#Model#<br></cfoutput>

Then this will pass through to the form as a list of models in variable yachts.
0
 

Author Comment

by:MsReba
ID: 10856058
Could it be that problems are in the fact that the dynamic i
<input type=checkbox name=#Model# value=#Model#>
ends up being in HTML:
<input type=checkbox name=280 Epress value=280 Express> and so on down through the list of different models. The spaces in the input name, could that be an issue? Model is actually the fieldname in the database. However, I have tried it statically too and well nothing is working correctly.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856069
Yes, see above post.

<input type=checkbox name="Model" value="#Model#">

Name must be fixed,

This will then pass a list of values containing the models as Form.Model
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856080
So in summary.

This in your form

<input type=checkbox name=Model value=#Model#>

with this in your action page.

<cfif isDefined("form.yourmodel") and ListLen(form.yourmodel)>
     <cfloop index="i" list="#form.yourmodel#">
          <cfoutput>#i#<br /></cfoutput>
     </cfloop>
</cfif>

NOTE! name=Model on the <input NOT #Model#
0
 

Author Comment

by:MsReba
ID: 10856153
OK here are a set of 3 organized commented codes I have tried. None work. I think I need to "PLEASE STEP AWAY FROM THE COMPUTER". All are being used as you can see with the input name being static or "Model" not "#Model#".

<!------1 from form using <input type="checkbox" name="Model" value="#Model#">#Model#--->
            <cfset lstModel = " ">
            <cfloop index="lst" list="#form.Model#" delimiters=",">
            <cfif isDefined("form.Model")>
                  <cfset lstModel=ListAppend(lstModel,evaluate(lst))>
                  <cfoutput>#i#<br></cfoutput>
            </cfif>
      </cfloop>
                  <!---1 returned -- INVALID CFML CONSTRUCT FOUND ERROR--->
<!----------2 from form using <input type="checkbox" name="Model" value="#Model#">#Model#--->
            
            <cfif isDefined("form.Model") and ListLen("form.Model")>
                 <cfloop index="i" list="#form.Model#">
                <cfoutput>#i#<br></cfoutput>
                 </cfloop>
             </cfif>
            <!---CODE 2 RETURNED UNDEFINED VALUE ERROR--->
<!----------3
from form using <input type="checkbox" name="Model" value="#Model#">#Model#--->
no errors but no yachts in email using input name=#Model#
       <cfloop index="i" from="0" to="12">
             <cfif isDefined("form.Model")>
                  <cfoutput>#i#<br></cfoutput>
            </cfif>
      </cfloop>----->
<!---CODE 3 RETURNED UNDEFINED VALUE ERROR----->

I am dumping <cfdump var="#form.Model#"> and getting the following as an exact dump:

400 Express,405 Exress Motoryacht,455 Express Motoryacht,540 Express

0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856194
Ok,

The last one is rubbish, I will contain the values 0 to 12, so that's not going to do anything for you.

The second one should work perfectly given the values you have dumped from form.Model.

This works perfectly for me, trying doing the <Cfset to see if it works for you.

<cfset form.model = "400 Express,405 Exress Motoryacht,455 Express Motoryacht,540 Express">

<cfif isDefined("form.model") and ListLen(form.model)>
      <cfloop index="i" list="#form.model#">
            <cfoutput>#i#<br /></cfoutput>
      </cfloop>
</cfif>

outputs

400 Express
405 Exress Motoryacht
455 Express Motoryacht
540 Express

You can also try doing the <cfdump var="#form.model#"> where the <cfset is to make sure it still has a value at that point and is not being reset somewhere else in your code. Also I don't believe <CFMAIL would have any impact, but try the loop before the <CFMAIL and just output it to the screen to see what happens.

Other than that post all the code of the two pages and i'll have a look.
0
 

Author Comment

by:MsReba
ID: 10856277
I appreciate the help. It is a fact that checkboxes can be tricky eh? I have spent hours upon hours going through this process and studying MM site and Ben Forta books yadda yadda. I'm just not getting the right recipe. Look forward to what you come up with. I'll keep fussing around in the meantime. Thanks a million for your assistance.
LIVE WELL, LAUGH OFTEN AND LOVE MUCH!
Reba

HERE'S MY STUFF:

FORM PAGE:
<!---
Application:            None Specified
Filename:           catalog.cfm                  
Author:                        Reba Ramsour
Type of File:          Standard Template
Description:        catalog request form submits to Jim Penix            

Modifications:
- 02/29/2004  11:01- RR - Template created
--->
<html>
<head>
<title>Northside Marine Yacht Sales</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta name="robots" content="all">
<meta name="robots" content="index">
<meta name="robots" content="follow">
<META NAME="DESCRIPTION" CONTENT="">
<META NAME="KEYWORDS" CONTENT="">
</head>

<!---HEADER INCLUDE--->
<cfinclude template="head1.cfm">
<!---LEFT NAVIGATION INCLUDE--->
<cfinclude template="leftnav.cfm">

<!---MAIN CONTENT AREA FOR ALL SITE PAGES------------------------------>
<!---DO NOT MESS WITH MAIN TR, TD TAGS----------->
<!---IF NECESSARY NEST WITHIN MAIN TD TAG ON LINE 28-http://www.cruzfla.com/northsidemarine/catalogproc.cfm------->

 <td colspan="2" bgcolor="#ffFFFF" align="center">
 <form name="request" method="post" action="catalogproc2.cfm">
        <table class="t1" width="600" border="0" cellspacing="0" cellpadding="0">
    <tr>
            <td colspan="6" align="left"><br><strong>APP IN DEVELOPMENT PROCESS <BR> WHEN PAGE IS SUBMITTED, VERIFICATION THANKYOU PAGE; EMAIL SENT TO JIM WITH CLIENT INFORMATION AND CHECKBOX VALUES<BR>Catalog Request Form</strong>&nbsp;</td>
          </tr>

              <tr>
            <td colspan="6">&nbsp;</td>
          </tr>
          <tr>
            <td width="69">Name</td>
            <td colspan="2">
                  <input name="Name" type="text" id="name" size="50" maxlength="30">
                  <input type="hidden" name="name_required" value="Please enter your name">
                  <input type="hidden" name="Name" value=""> </td>
            <td width="98">&nbsp;</td>
            <td width="52">&nbsp;</td>
            <td width="117">&nbsp;</td>
          </tr>
          <tr>
            <td>Address</td>
            <td colspan="2">
                  <input name="Address" type="text" id="address" size="50" maxlength="50">
                  <input type="hidden" name="address_required" value="Please enter your address">
                  <input type="hidden" name="Address" value="">
                   </td>
            <td width="63">&nbsp;</td>
            <td width="63">&nbsp;</td>
            <td width="63">&nbsp;</td>
          </tr>
          <tr>
            <td>City</td>
            <td width="217">
                  <input name="city" type="text" id="city" size="30" maxlength="20">
                  <input type="hidden" name="city_required" value="Please enter your city">
                  <input type="hidden" name="city" value="">
            </td>
            <td width="33">State</td>
            <td><select name="state" size="1">

<option value="">
<OPTION VALUE="AL">AL
<OPTION VALUE="AK">AK
<OPTION VALUE="AR">AR
<OPTION VALUE="AZ">AZ
<OPTION VALUE="CA">CA
<OPTION VALUE="CO">CO
<OPTION VALUE="CT">CT
<OPTION VALUE="DC">DC
<OPTION VALUE="DE">DE
<OPTION VALUE="FL">FL
<OPTION VALUE="GA">GA
<OPTION VALUE="HI">HI
<OPTION VALUE="IA">IA
<OPTION VALUE="ID">ID
<OPTION VALUE="IL">IL
<OPTION VALUE="IN">IN
<OPTION VALUE="KS">KS
<OPTION VALUE="KY">KY
<OPTION VALUE="LA">LA
<OPTION VALUE="MA">MA
<OPTION VALUE="ME">ME
<OPTION VALUE="MD">MD
<OPTION VALUE="MI">MI
<OPTION VALUE="MO">MO
<OPTION VALUE="MN">MN
<OPTION VALUE="MS">MS
<OPTION VALUE="MT">MT
<OPTION VALUE="NC">NC
<OPTION VALUE="ND">ND
<OPTION VALUE="NE">NE
<OPTION VALUE="NH">NH
<OPTION VALUE="NJ">NJ
<OPTION VALUE="NM">NM
<OPTION VALUE="NV">NV
<OPTION VALUE="NY">NY
<OPTION VALUE="OH">OH
<OPTION VALUE="OK">OK
<OPTION VALUE="OR">OR
<OPTION VALUE="PA">PA
<OPTION VALUE="RI">RI
<OPTION VALUE="SC">SC
<OPTION VALUE="SD">SD
<OPTION VALUE="TN">TN
<OPTION VALUE="TX">TX
<OPTION VALUE="UT">UT
<OPTION VALUE="VA">VA
<OPTION VALUE="VT">VT
<OPTION VALUE="WA">WA
<OPTION VALUE="WI">WI
<OPTION VALUE="WV">WV
<OPTION VALUE="WY">WY
</SELECT>
</td>
            <td>Zip</td>
            <td>
                  <input name="zip" type="text" id="zip" size="10" maxlength="10">
                  <input type="hidden" name="zip_required" value="Please enter your zip code">
                  <input type="hidden" name="zip" value="">
                  </td>
          </tr>
          <tr>
                    <td>Phone</td>
            <td colspan="5">
                  <input name="phone" type="text" size="20" maxlength="15">  <font size="-1">xxx-xxx-xxxx</font>
                  <input type="hidden" name="phone" value="">
                  </td></tr>
          <tr>
                    <td>Email</td>
                    <td colspan="5">
                  <input name="email" type="text" size="40">
                  <input type="hidden" name="email" value="">
                  <input type="hidden" name="email_required" value="Please enter your email address">
                  </td>
          </tr>
          <tr>
            <td colspan="6">&nbsp;</td>
          </tr>
        </table>
                  
        <table class="t1" width="600" border="0" cellspacing="0" cellpadding="0">
          <tr>
              <td width="120">Currently Own?</td>
              <td width="100"><input name="own" type="radio" value="yes" checked>
                yes
                <input type="radio" name="own" value="no">
                        <input type="hidden" name="own" value="">
                no</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td>Model</td>
              <td>
                    <input name="yourmodel" type="text" id="yourmodel">
                    <input type="hidden" name="yourmodel" value="">
                    </td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td>Year</td>
              <td>
                    <input name="year" type="text" id="year">
                    <input type="hidden" name="year" value=""></td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td>Size</td>
              <td>
                    <input name="size" type="text" id="size">
                    <input type="hidden" name="size" value="">
                    </td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="6">&nbsp;</td>
             
            </tr>
            <tr>
              <td>How did you find us?</td>
              <td><select name="referredBy">
                                      <option name="referral" value=""></option>
                                      <option name="referral" value="Google">Google</option>
                                    <option name="referral" value="Yahoo">Yahoo</option>
                                    <option name="referral" value="Ask Jeeves">Ask Jeeves</option>
                                    <option name="referral" value="Business Card">Business Card</option>
                                    <option name="referral" value="Friend">Friend</option>
                                    <option name="referral" value="Other">Other</option>
                </select>
                        <input type="hidden" name="referredBy" value=""></td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="6">&nbsp;</td>
             
            </tr>
            <tr>
              <td colspan="6">Please check the specific model you
                are interested in:</td>
            </tr>
            <tr>
              <td colspan="6">&nbsp;</td>
             
            </tr>
           <tr>
              <td colspan="6"  bgcolor="#003399" height="2"></td>
            </tr>
                  <tr>
              <td colspan="6" height="5">&nbsp;</td>
            </tr>
                  </table>
            <table class="t1" width="600" border="0" cellspacing="0" cellpadding="0">
          <tr bgcolor="#CCCCCC">
            <td colspan="2" width="200" align="left"><strong>Cruiser's</strong></td>  
                  <td colspan="2" width="200" align="left"><strong>Luhr's</strong></td>
                  <td colspan="2" width="200" align="left"><strong>Mainship</strong></td>
            </tr>
 
          <tr valign="top">
            <td colspan="2" align="left">
                  <cfquery name="getModels1" datasource="#DSN#" username="#UN#" password="#PW#">
SELECT tblModel.Model_id, tblModel.Model, tbl.Model.Comp_id, tblCompanies.Comp_id, tblModel.BitValue, tblCompanies.CompName
FROM tblModel,tblCompanies
WHERE tblModel.Comp_id = 1 and tblCompanies.Comp_id = 1
</cfquery>
<cfoutput query="getModels1">
<!--removed lb signs from name=Model--->
<input type="checkbox" name="Model" value="#Model#">#Model#
<!---<input type="checkbox" name="Model_#BitValue#" value="#Model#">#Model#--->
<!---<input type="checkbox" name="Model1_#BitValue#" value="1">#Model#---> <!---#BitValue# #Comp_id#---> <br></cfoutput>

</td>
   <!---  COMMENTED OUT FOR EASE OF TESTING. GET ONE WORKING FIRST THEN GO FOR IT--->
   <!-----        
            <td colspan="2" align="left">
                  <cfquery name="getModels2" datasource="#DSN#" username="#UN#" password="#PW#">
SELECT tblModel.Model_id, tblModel.Model, tblModel.Comp_id, tblModel.BitValue, tblCompanies.CompName
FROM tblModel,tblCompanies
WHERE tblModel.Comp_id = 2 and tblCompanies.Comp_id = 2
</cfquery>
<cfoutput query="getModels2">

<input type="checkbox" name="Model2_#BitValue#" value="1">#Model# <!---#BitValue# #Comp_id#---><br></cfoutput>
</td>
            <td colspan="2" align="left">
                  <cfquery name="getModels3" datasource="#DSN#" username="#UN#" password="#PW#">
SELECT tblModel.Model_id, tblModel.Model, tblModel.Comp_id, tblModel.BitValue, tblCompanies.CompName
FROM tblModel,tblCompanies
WHERE tblModel.Comp_id = 3 and tblCompanies.Comp_id = 3
</cfquery>
<cfoutput query="getModels3">

<input type="checkbox" name="Model3_#BitValue#" value="1">#Model# <!---#BitValue# #Comp_id#---><br></cfoutput>
</td>--->
            </tr>  
         
            <tr>
              <td colspan="6" bgcolor="#003399" height="2"></td>
            </tr>
                  <tr>
              <td colspan="6" height="5">&nbsp;</td>
            </tr>
           
         
            <tr>
              <td colspan="6">&nbsp;</td>
            </tr>
            <tr>
              <td width="63">&nbsp;</td>
              <td><div align="center">
                  <input name="Reset" type="reset" value="Reset">
                </div></td>
              <td colspan="2"><div align="center">
                  <input type="submit" name="Submit" value="Submit">
                </div></td>
              <td width="63">&nbsp;</td>
              <td width="63">&nbsp;</td>
            </tr>
            <tr>
              <td colspan="6">&nbsp;</td>
             
            </tr>
         
        </table>
   
        </form></td>
  </tr>



<!---FOOTER INCLUDE----------->
<cfinclude template="foot1.cfm">

PROCESSING PAGE:

<!---
Application:            None Specified
Filename:                  catalogproc.cfm
Author:                        Reba Ramsour
Type of File:          Standard Template
Description:            Contact information form

Modifications:
- 04/03/2004  4:41pm - RR - Template created
--->
<!---HEADER INCLUDE--->
<cfinclude template="head1.cfm">
<!---LEFT NAVIGATION INCLUDE--->
<cfinclude template="leftnav.cfm">

<!---MAIN CONTENT AREA FOR ALL SITE PAGES------------------------------>
<!---DO NOT MESS WITH MAIN TR, TD TAGS----------->
<!---IF NECESSARY NEST WITHIN MAIN TD TAG ON LINE 28-------->

<td colspan="2" bgcolor="#ffFFFF" align="center" valign="top">
<!-------->
<cfparam name="state" default="">
<cfparam name="phone" default="">
<cfparam name="own" default="">
<cfparam name="model" default="">
<cfparam name="year" default="">
<cfparam name="size" default="">
<cfparam name="referredBy" default="">
<cfquery name="getModels1" datasource="#DSN#" username="#UN#" password="#PW#">
SELECT tblModel.Model_id, tblModel.Model, tbl.Model.Comp_id, tblCompanies.Comp_id, tblModel.BitValue, tblCompanies.CompName
FROM tblModel,tblCompanies
WHERE tblModel.Comp_id = 1 and tblCompanies.Comp_id = 1
</cfquery>
<cfoutput query="getModels1">
<!---<cfparam name="Model_#BitValue#" default="540 Express">--->
<cfparam name="Model" default="no">

</cfoutput>            
<!---KEEPS PEOPLE FROM USING THIS IF THEY DIDN'T COME FROM THE EMAIL FORM PAGE--->
    <cfif isdefined("form.name")>
      <cfmail to ="reba@cruzfla.com"
            from="reba@cruzfla.com"
            subject="Catalog Request"
            timeout="60"
            server="mail.cruzfla.com"
            type="HTML">
      
            <table align="left" width="400" border="0">
            
        <tr>
                  <td align="left" colspan="6">Jim,<br>This is a request for catalog/catalogs for the specified models.</td>
            </tr>
            <tr>
                  <td colspan="6">#form.name#</td>
            </tr>
            <tr>
                  <td colspan="6">#form.address#</td>
            </tr>
            <tr>
                  <td align="left" colspan="6">#form.city#, #form.state#  #form.zip#</td>
            </tr>
        <tr>
                  <td colspan="6" align="left">#form.phone#</td>
            </tr>
            <tr>
                  <td colspan="6">#form.email#</td>
            </tr>
            <tr>
                  <td align="left">Currently own?</td>
                  <td colspan="5">#form.own#</td>
            </tr>
            <tr>
                  <td align="left">Model:</td>
                  <td colspan="5">#form.yourmodel#</td>
            </tr>
            <tr>
                  <td align="left">Year:</td>
                  <td align="left" colspan="5">#form.year#</td>
            </tr>
            <tr>
                  <td align="left">Size:</td>
                  <td align="left" colspan="5">#form.size#</td>
            </tr>
            <tr>
                  <td align="left">How did you find us?</td>
                  <td align="left" colspan="5">
                  <cfif len(trim(form.referredBy))>
                        #form.referredBy#
                  </cfif></td>
            </tr>
            <tr>
                  <td align="left" colspan="6"><strong>Catalog Choices:</strong></td>
            </tr>
            <tr>
                  <td colspan="6">
<!-------------<cfloop index="i" from="0" to="12">---------------------------------------------_#i#----->

<!------1 from form using <input type="checkbox" name="Model" value="#Model#">#Model#INVALID CFML CONSTRUCT FOUND ERROR
      
            <cfset lstModel = " ">
            <cfloop index="lst" list="#form.Model#" delimiters=",">
            <cfif isDefined("form.Model")>
                  <cfset lstModel=ListAppend(lst,evaluate(lst))>
                  <cfoutput>#lst#<br></cfoutput>
            </cfif>
      </cfloop>--->
                  
<!----------2from form using <input type="checkbox" name="Model" value="#Model#">#Model#CODE 2 RETURNED UNDEFINED VALUE ERROR--->
            <cfset form.Model = "400 Express,405 Exress Motoryacht,455 Express Motoryacht,540 Express">
            <cfif isDefined("form.Model") and ListLen("form.Model")>
                 <cfloop index="i" list="#form.Model#">
                <cfoutput>#i#<br></cfoutput>
                 </cfloop>
             </cfif>
<!---23A from Experst Exchange forum
<cfif isDefined("form.model") and ListLen(form.model)>
     <cfloop index="i" list="#form.model#">
          <cfoutput>#i#<br /></cfoutput>
     </cfloop>
</cfif>
 --->
<!----------3
from form using <input type="checkbox" name="Model" value="#Model#">#Model#
no errors but no yachts in email using input name=#Model#
       <cfloop index="i" from="0" to="12">
             <cfif isDefined("form.Model")>
                  <cfoutput>#i#<br></cfoutput>
            </cfif>
      </cfloop>----->
<!---CODE 3 RETURNED UNDEFINED VALUE ERROR----->

      
---------------------------------
<!---
Hard Code Works but leaves white space if there is no value for the variable (no check in the box)
#form.Model_0#<br>
#form.Model_1#<br>
#form.Model_2#<br>
#form.Model_3#<br>
#form.Model_4#<br>
#form.Model_5#<br>
#form.Model_6#<br>
#form.Model_7#<br>
#form.Model_8#<br>
#form.Model_9#<br>
#form.Model_10#<br>
#form.Model_11#<br>
--->
        <!---CHANGE SERVER TO NMYS--->
            </table>
      </cfmail>
      <table width="400" height="75" align="center" valign="top" border="0">
              <tr>
                  <td height="30">&nbsp;</td></tr>
        <tr>
          <td colspan="2"><br>
            Thank you <cfoutput>#form.name#</cfoutput>,
            <p>Your request has been sent to Northside Marine Yacht Sales. We will promptly process your request for the selected catalog of interest. We look for ward to assisting you in choosing the yacht of your dreams in the near future.</p>
            </font> </td>
        </tr>
        <tr>
          <td width="175">&nbsp;</td>
          <td align="left">Thank you,</td>
        </tr>
        <tr>
          <td width="175">&nbsp;</td>
          <td align="left">Jim Penix<br>
            Northside Marine Yacht Sales</td>
        </tr>
      </table>
    </cfif>
      </td>
  </tr>
  <cfdump var="#form.Model#">
<cfinclude template="foot1.cfm">
0
 
LVL 18

Accepted Solution

by:
Plucka earned 500 total points
ID: 10856322
Ahh,

I see the problem, lots easier when you have the code.

You can't have a <CFOUTPUT within a <CFMAIL.

Just change it to

<cfif isDefined("form.model") and ListLen(form.model)>
     <cfloop index="i" list="#form.model#">
          #i#<br />
     </cfloop>
</cfif>
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856332
I just tested it and it all works well, got the email with the ticked values. Sent a test through to you.

Let me know if your still stuck.
0
 

Author Comment

by:MsReba
ID: 10856401
OH GREAT ONE OR SHALL I SAY "MASTER PO" LET ME BE YOUR GRASSHOPPER!

Or are you to young to know who Po and Grasshopper are? ;)

I can not thank you enough! The time I have spent on this. However, even though I spent all that time, I have actually been learning as well. Just not the right thing, but now, thanks to you, I am one step closer to becoming a cold fusion queen. Right now I'm just a WANNABE CF QUEEN. ;)

An infinite loop of thanks!

I hope I as well can "Pay it forward someday."

Reba
Sunny FL
reba@cruzfla.com

NOW I CAN SLEEP TONIGHT! THANK YOU.
0
 
LVL 18

Expert Comment

by:Plucka
ID: 10856412
No problem, happy to help.
0

Featured Post

Network it in WD Red

There's an industry-leading WD Red drive for every compatible NAS system to help fulfill your data storage needs. With drives up to 8TB, WD Red offers a wide array of solutions for customers looking to build the biggest, best-performing NAS storage solution.  

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

757 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

22 Experts available now in Live!

Get 1:1 Help Now