scripter73
Programmer
I have the following two CFLOOP statements:
<cfset vehcounter=0>
<CFLOOP QUERY="vehlook">
<cfset vehcounter = vehcounter + 1>
<cfset veh_entry = '#vehlook.wveh_vehicle_year# #vehlook.wveh_vehicle_make# #vehlook.wveh_vehicle_model# #vehlook.wveh_vehicle_id#'>
<input type="checkbox" name="vehlist<cfoutput>#vehcounter#</cfoutput>" value="<cfoutput>#veh_entry#</cfoutput>"><b><cfoutput>#veh_e
ntry#</cfoutput></b><br>
</CFLOOP>
<cfset drvcounter = 0>
<CFLOOP QUERY="drvlook">
<cfset drvcounter = drvcounter+1>
<cfset drv_entry = '#drvlook.wdrv_driver_name#'>
<input type="checkbox" name="drvlist<cfoutput>#drvcounter#</cfoutput>"
value="<cfoutput>#drv_entry#</cfoutput>"><b><cfoutput>#drv_e
ntry#</cfoutput>
<cfif drvlook.wdrv_excluded_ind eq 'Y'><cfoutput><font color="red">(Excluded)</font></cfoutput>
</cfif></b><br>
</CFLOOP>
The two query "vehlook" and "drvlook" are defined elsewhere in the code and are successful because I can see my dynamically created checkboxes.
I want to make sure I'm naming the text boxes the right thing. Preferably I want every checkbox to
correspond with its name like, vehlist1, vehlist2, and drvlist1, and drvlist2, etc.
When I display my form with this data, everything shows fine. However I have a button in my form
that when the user clicks on it, it is supposed to show the name of the checkboxes and its corre-
sponding value. This is a test to verify naming. Also my form's name is "form1". This is in Javascript, and the code is as follows:
<script language="Javascript">
function display_names(){
//assigns the fields of the contact section the same fields as
//the insured section and refreshes the browser page
document.write(document.form1.vehlist1.name + "= "
+ document.form1.vehlist1.value);
document.write(document.form1.vehlist2.name + "= "
+ document.form1.vehlist2.value);
document.write(document.form1.drvlist1.name + "= "
+ document.form1.drvlist1.value);
}
// -->
</script>
}
When I click my 'Continue' button to process the Javascript, I only get a listing for vehlist1. What about the others like vehlist2 and drvlist1?
What am I doing wrong? I just want to make sure that I name my checkboxes correctly and
since they're dynamically created, I have to be a little creative to name them appropriately.
Thanks in advance,
scripter73
<cfset vehcounter=0>
<CFLOOP QUERY="vehlook">
<cfset vehcounter = vehcounter + 1>
<cfset veh_entry = '#vehlook.wveh_vehicle_year# #vehlook.wveh_vehicle_make# #vehlook.wveh_vehicle_model# #vehlook.wveh_vehicle_id#'>
<input type="checkbox" name="vehlist<cfoutput>#vehcounter#</cfoutput>" value="<cfoutput>#veh_entry#</cfoutput>"><b><cfoutput>#veh_e
ntry#</cfoutput></b><br>
</CFLOOP>
<cfset drvcounter = 0>
<CFLOOP QUERY="drvlook">
<cfset drvcounter = drvcounter+1>
<cfset drv_entry = '#drvlook.wdrv_driver_name#'>
<input type="checkbox" name="drvlist<cfoutput>#drvcounter#</cfoutput>"
value="<cfoutput>#drv_entry#</cfoutput>"><b><cfoutput>#drv_e
ntry#</cfoutput>
<cfif drvlook.wdrv_excluded_ind eq 'Y'><cfoutput><font color="red">(Excluded)</font></cfoutput>
</cfif></b><br>
</CFLOOP>
The two query "vehlook" and "drvlook" are defined elsewhere in the code and are successful because I can see my dynamically created checkboxes.
I want to make sure I'm naming the text boxes the right thing. Preferably I want every checkbox to
correspond with its name like, vehlist1, vehlist2, and drvlist1, and drvlist2, etc.
When I display my form with this data, everything shows fine. However I have a button in my form
that when the user clicks on it, it is supposed to show the name of the checkboxes and its corre-
sponding value. This is a test to verify naming. Also my form's name is "form1". This is in Javascript, and the code is as follows:
<script language="Javascript">
function display_names(){
//assigns the fields of the contact section the same fields as
//the insured section and refreshes the browser page
document.write(document.form1.vehlist1.name + "= "
+ document.form1.vehlist1.value);
document.write(document.form1.vehlist2.name + "= "
+ document.form1.vehlist2.value);
document.write(document.form1.drvlist1.name + "= "
+ document.form1.drvlist1.value);
}
// -->
</script>
}
When I click my 'Continue' button to process the Javascript, I only get a listing for vehlist1. What about the others like vehlist2 and drvlist1?
What am I doing wrong? I just want to make sure that I name my checkboxes correctly and
since they're dynamically created, I have to be a little creative to name them appropriately.
Thanks in advance,
scripter73