Coldfusion8 Parameter index out of range error - coldfusion

I'm doing something stupid, but I don't know what it is, can someone point out to me why I am getting this error:
Parameter index out of range (1 > number of parameters, which is 0).
From this code,
This form:
<form id="form1" name="form1" method="post" action="?template=/Assets/Plugins/AmericanSurcharges/index.cfm&action=add" class="inputform">
<tr>
<td>
<select name="datamonth">
<option value=""></option>
<cfloop from="1" to="12" step="1" index="i">
<cfset option = monthasstring(i) />
<option value="#i#" >#option#</option>
</cfloop>
</select>
</td>
<td><input name="201data" type="text" id="201" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="301data" type="text" id="301" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="304data" type="text" id="304" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="316data" type="text" id="316" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="409data" type="text" id="409" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="430data" type="text" id="430" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="410data" type="text" id="410" size="6" maxlength="7" value="" class="data" /></td>
<td><input name="2205data" type="text" id="2205" size="6" maxlength="7" value="" class="data" /></td>
<td> </td>
<td><input type="submit" name="submit" id="submit" value=" Insert " /></td>
</tr>
</form>
posts to this script:
modObj = createObject("component", "surcharge");
command = modObj.insertsurcharges(form);
writeoutput(command);
calling this function:
<cffunction name="insertsurcharges" access="public" output="no" returntype="string" >
<cfargument name="form" required="yes" type="struct" />
<cfquery name="insertsurcharges" datasource="#variables.dsn#" result="insertsurcharges_result">
insert into nas_staticvalues (`datamonth`,`201`,`301`,`304`,`316`,`409`,`430`,`410`,`2205`) values
(
`<cfqueryparam value="#form.datamonth#" CFSQLType="CF_SQL_VARCHAR" null="no" maxlength="20" />`,
`<cfqueryparam value="#form.201data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.301data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.304data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.316data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.409data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.430data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.410data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`,
`<cfqueryparam value="#form.2205data#" CFSQLType="CF_SQL_FLOAT" null="no" scale="4" />`
)
</cfquery>
<cfreturn insertsurcharges_result.GENERATED_KEY />
</cffunction>
and I constantly get the same error.
If I replace all the queryparams with:
'#form.datamonth#',
'#form.201data#',
'#form.301data#',
'#form.304data#',
'#form.316data#',
'#form.409data#',
'#form.430data#',
'#form.410data#',
'#form.2205data#'
The insert works, also if I take the sql that coldfusion tried to run with the queryparams & just run it on mysql - that works as well!
insert into nas_staticvalues (`datamonth`,`201`,`301`,`304`,`316`,`409`,`430`,`410`,`2205`) values ( ` (param 1) `, ` (param 2) `, ` (param 3) `, ` (param 4) `, ` (param 5) `, ` (param 6) `, ` (param 7) `, ` (param 8) `, ` (param 9) ` )
the database accepts 6 digit with 4 decimal places for all the sql_float types.
I must be missing something with the cfqueryparam attributes - right?

cfqueryparam never needs the quotes. It will construct the query with quotes when it needs them and without when it doesn't. That is one of the awesome parts about using cfqueryparam.

Related

Using GeoLocation variables in CFSET

I'm trying to capture geolocation data and insert it into a database.
The code below is my attempt to capture the browser's longitude and latitude and save the values in two form fields. The problem is the output code generates multiple instances of the two form fields (i.e. "longitude" and "longitude"). Here's a screen shot of a single set of those fields being populated. How do I populate the rest?
Form Code:
<div class="table-responsive">
<table class="table table-1" style="color:##000000">
<tr>
<td>Tree No</td>
<td>Current Status</td>
<td>Graft Successful</td>
<td>NOT Grafted</td>
<td>Graft unsuccessful</td>
<td>Tree Died</td>
</tr>
<cfoutput query="rsTreeList" >
<tr>
<td>#TreeID#</td>
<td>#Status#</td>
<td>
<form name="form1" method="post" action="Recon_Update_Logic1.cfm?ID=#TreeID#">
<img src="images/Icons/Success.jpg" width="25" height="25" alt=""/>
<input id="latitude" name="latitude" type="text" />
<input id="longitude" name="longitude" type="hidden" />
<input name="submit" type="submit" id="Submit" value="Graft Successful">
</form>
</td>
<td>
<form name="form1" method="post" action="Recon_Update_Logic2.cfm?ID=#TreeID#">
<img src="images/Icons/NotGrafted.jpg" width="25" height="25" alt=""/>
<input id="latitude" name="latitude" type="text" />
<input id="longitude" name="longitude" type="hidden" />
<input name="submit" type="submit" id="Submit" value="NOT Grafted">
</form>
</td>
<td>
<form name="form1" method="post" action="Recon_Update_Logic3.cfm?ID=#TreeID#">
<img src="images/Icons/GraftUnsuccessful.jpg" width="25" height="25" alt=""/>
<input id="latitude" name="latitude" type="hidden" />
<input id="longitude" name="longitude" type="hidden" />
<input name="submit" type="submit" id="Submit" value="Graft Unsuccessful">
</form>
</td>
<td>
<form name="form1" method="post" action="Recon_Update_Logic4.cfm?ID=#TreeID#">
<img src="images/Icons/TreeDead.jpg" width="25" height="25" alt=""/>
<input id="latitude" name="latitude" type="hidden" />
<input id="longitude" name="longitude" type="hidden" />
<input name="submit" type="submit" id="Submit" value="Tree Dead">
</form>
</td>
</tr>
</cfoutput>
</table>
</div>
The following code attempts to populate all of the "latitude" and "longitude" elements:
<cfloop index="i" from="1" to="#rsTreeList.recordCount#">
<script>
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
}
function showPosition(position)
{
document.getElementById("latitude").value = position.coords.latitude;
document.getElementByID("longitude").value = position.coords.longitude;
}
getLocation();
</script>
</cfloop>

How to properly submit only one form in table of ModelForms in Django?

I need to create a table of forms for creating and updating users based on my custom User model. It must look something like this:
Form is presented as particular row in table.
Save button saves submits form, Delete removes form and the model instance from database, Add button appends new blank form to end of <tbody> but to save new form we need to click Save button.
Now I'm stuck and don't know how to properly implement logic above. I need each form to be updated and submitted independently. I looked up for solutions based on ModelFormSet but it submits all forms and does not allow to update only one particular row of data.
How we can create prepopulated ModelFormSet where each row of form data can be submitted regardless of other forms in table? Like this:
<form action="" method="post">
<tr>
<td>1</td>
<td> <input type="text" name="username" value="admin" maxlength="255" class="login-input" id="id_username" /></td>
<td> <input type="text" name="password" value="" maxlength="128" class="password-input" id="id_password" /></td>
<td> <input type="text" name="email" maxlength="255" class="email-input" id="id_email" /></td>
<td> <input type="checkbox" name="active" class="checkbox-input" id="id_active" checked /></td>
<td> <input type="checkbox" name="staff" class="checkbox-input" id="id_staff" checked /></td>
<td> <input type="checkbox" name="reboot_field" class="checkbox-input" id="id_reboot_field" checked /></td>
<td><button type="submit" form="form1">Save</button></td>
<td><button form="form1" >Delete</button></td>
<tr>
</form>
<form action="" method="post">
<tr>
<td>2</td>
<td> <input type="text" name="username" value="user1" maxlength="255" class="login-input" id="id_username" /></td>
<td> <input type="text" name="password" value="" maxlength="128" class="password-input" id="id_password" /></td>
<td> <input type="text" name="email" maxlength="255" class="email-input" id="id_email" /></td>
<td> <input type="checkbox" name="active" class="checkbox-input" id="id_active" checked /></td>
<td> <input type="checkbox" name="staff" class="checkbox-input" id="id_staff" checked /></td>
<td> <input type="checkbox" name="reboot_field" class="checkbox-input" id="id_reboot_field" checked /></td>
<td><button type="submit" form="form2" >Save</button></td>
<td><button form="form2">Delete</button></td>
<tr>
</form>
Found the solution based on this link.

Picture submit to database blob and control size

I have a registration page that will submit all the registration values into MS SQL database. I am trying to control the size of the image that is updated to the database to be width=125 height=125. Is there a way to control that before it is submitted into the database?
Also is this the most recent way to submit it into the database?(The most recent I could find was 2011)
FORM
<form class="m-t" role="form" action="cfm/register_process.cfm" method="post" enctype="multipart/form-data">
<div class="form-group">
<input type="text" name="employee_number" class="form-control" placeholder="Employee Number" required="">
</div>
<div class="form-group">
<input type="text" name="firstname" class="form-control" placeholder="First Name" required="">
</div>
<div class="form-group">
<input type="text" name="lastname" class="form-control" placeholder="Last Name" required="">
</div>
<div class="form-group">
<input type="text" name="department" class="form-control" placeholder="Department" required="">
</div>
<div class="form-group">
<input type="text" name="position" class="form-control" placeholder="Position" required="">
</div>
<div class="form-group">
<input type="email" name="email" class="form-control" placeholder="Email" required="">
</div>
<div class="form-group">
<input type="text" name="phone_extension" class="form-control" placeholder="Extension" required="">
</div>
<div class="form-group">
<input type="text" name="user_name" class="form-control" placeholder="User ID" required="">
</div>
<div class="form-group">
<input type="password" name="user_pass" class="form-control" placeholder="Password" required="">
</div>
<div class="input-group">
<span class="input-group-btn">
<span class="btn btn-primary btn-file">
Select image
<input type="file" name="filefieldname" id="filefieldname" multiple />
</span>
</span>
<input id="filename" class="form-control" type="text"/>
<span class="input-group-btn">
<span class="btn btn-primary cleared">Reset</span>
</span>
</div>
<div class="form-group">
<div class="checkbox i-checks"><label> <input type="checkbox"><i></i> Agree the terms and policy </label></div>
</div>
<button type="submit" class="btn btn-primary block full-width m-b">Register</button>
<p class="text-muted text-center"><small>Already have an account?</small></p>
<a class="btn btn-sm btn-white btn-block" href="login.html">Login</a>
</form>
Then the form calls register_process.cfm and submits to database
<cffile action="readbinary" file="#form.filefieldname#" variable="bin_filedata">
<cfquery datasource="test" name="UserRegistration">
INSERT INTO dbo.Users (employee_number, user_name, user_pass, firstname, lastname, position, email, phone_extension, department, picture)
VALUES (
, <cfqueryparam value='#form.employee_number#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.user_name#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.user_pass#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.firstname#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.lastname#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.position#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.email#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.phone_extension#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#form.department#' cfsqltype='cf_sql_varchar' />
, <cfqueryparam value='#bin_filedata#' cfsqltype='cf_sql_blob' />
)
</cfquery>
<script>
self.location="../login.html";
</script>
Unfortunately when I try to submit this I just get an all white screen and it does not update the database. I am assuming I am doing something wrong with the picture.

How to stop a form from resubmitting

I would like to add additional functionality to a web site including the ability for a form to only be submitted once, this is so that when the user refreshes everything is not processed again etc.
I have looked at a few pieces of code using Jquery and javascript but was wondering if there was any way to do this in Coldfusion, and how do other people who use Coldfusion do it? I am looking for the most simple yet effective solution if possible.
Below is an example of a form that I would like to disable "resubmit" funtionality:
<cfinclude template="header.cfm">
<cfparam name="form.step" default="1">
<cfparam name="form.submit" default="">
<cfparam name="form.finish" default="">
<script type='text/javascript'>
//<![CDATA[
$(document).ready(function() {
var currentItem = 1;
$('#addnew').click(function(){
currentItem++;
$('#items').val(currentItem);
var strToAdd = '<tr><td class="Copy" valign="top">Item Name:</td><td><input type="text" name="Itemname'+currentItem+'" id="Itemname'+currentItem+'" required="yes" message="Please enter a Name" class="TextBlock"></td></tr><tr><td class="Copy" valign="top">Item Description:</td><td><input type="text" name="ItemDesc'+currentItem+'" id="ItemDesc'+currentItem+'" required="yes" message="Please enter a Description" class="TextBlock"></td></tr><tr><td class="Copy" valign="top">Quantity</td><td><input type="text" name="Quantity'+currentItem+'" id="Quantity'+currentItem+'" required="yes" message="Please enter a Quantity" class="TextBlock"></td></tr><tr><td class="Copy" valign="top">Product Code:</td><td><input type="text" name="Code'+currentItem+'" id="Code'+currentItem+'" required="yes" message="Please enter a Code" class="TextBlock"></td></tr><tr><td class="Copy" valign="top">Price:</td><td><input type="text" name="Price'+currentItem+'" id="Price'+currentItem+'" required="yes" message="Please enter a Price" class="TextBlock"></td></tr>';
$('#data').append(strToAdd);
});
});
//]]>
</script>
<cfif form.finish eq "finish">
<cflocation addtoken="no" url="inv_new.cfm">
</cfif>
<form id="formID" method="post" action="inv_new.cfm" enctype="multipart/form-data">
<table border="0" cellpadding="0" cellspacing="1" width="100%" class="Border" align="center">
<tr>
<td class="CopyWhite" align="left" background="images/tab_bg.gif" colspan="2">Add a new invoice</td>
</tr>
<cfoutput>
<cfif form.step eq 1>
<cfquery name="get_vendors" datasource="#application.db#">
SELECT * FROM tblpassVendor
WHERE vendorActive = 1
AND CompanyID = #session.companyid#
AND VendorID IN (#GetAdmin.AdminVendors#)
</cfquery>
<tr>
<td class="Copy" valign="top">Invoice Using:</td>
<td>
<Select name="INVBY">
<cfloop query="get_vendors">
<option value="#vendorid#">#vendorname#</option>
</cfloop>
</Select>
</td>
</tr>
<tr>
<td class="Copy" align="center" colspan="2">
<input type="Submit" name="Submit" value="Submit" class="submitbutton">
<input type="hidden" name="step" value="2" />
<input type="Reset" name="Reset" value="Reset" class="submitbutton">
</td>
</tr>
</cfif>
<cfif form.step eq 2>
<input type="hidden" name="vendor" value="#FORM.INVBY#" />
<tr>
<td class="Copy" valign="top">Order Details:</td>
<td>
</td>
</tr>
<tr>
<td class="Copy" valign="top">Payment Due:</td>
<td>
<input type="text" id="date1" class="validate[required]" name="INVPAYMENTDATE" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Reference Number:</td>
<td>
<input type="text" class="validate[required]" name="REFNUM" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Invoice Details:</td>
<td>
</td>
</tr>
<tr>
<td class="Copy" valign="top">Pay Using Masterpass:</td>
<td style="color:##000">
<input type="radio" name="MASTERPASS" value="1" checked="yes"> Yes<br />
<input type="radio" name="MASTERPASS" value="0" checked="no"> No<br />
</td>
</tr>
<tr>
<td class="Copy" valign="top">Pay Using Iveri:</td>
<td style="color:##000">
<input type="radio" name="IVERI" value="1" checked="yes"> Yes<br />
<input type="radio" name="IVERI" value="0" checked="no"> No<br />
</td>
</tr>
<tr>
<td class="Copy" valign="top">Pay Using Other:</td>
<td style="color:##000">
<input type="radio" name="OTHER" value="1" checked="yes"> Yes<br />
<input type="radio" name="OTHER" value="0" checked="no"> No<br />
</td>
</tr>
<tr>
<td class="Copy" valign="top">Billing Details:</td>
<td>
</td>
</tr>
<tr>
<td class="Copy" valign="top">Name:</td>
<td>
<input type="text" class="validate[required]" name="NAME" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Surname:</td>
<td>
<input type="text" class="validate[required]" name="LNAME" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Tel:</td>
<td>
<input type="text" class="validate[required]" name="TEL" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Email:</td>
<td>
<input type="text" class="validate[required,custom[email]]" name="EMAIL" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Address line 1:</td>
<td>
<input type="text" class="validate[required]" name="ADDR1" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Address line 2:</td>
<td>
<input type="text" class="validate[required]" name="ADDR2" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">City/Town:</td>
<td>
<input type="text" class="validate[required]" name="CITY" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Province/Region:</td>
<td>
<input type="text" class="validate[required]" name="REGION" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Country:</td>
<td>
<input type="text" class="validate[required]" name="COUNTRY" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">ZIP/Postal Code:</td>
<td>
<input type="text" class="validate[required]" name="ZIP" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" align="center" colspan="2">
<input type="Submit" name="Submit" value="Submit" class="submitbutton">
<input type="hidden" name="step" value="3" />
<input type="Reset" name="Reset" value="Reset" class="submitbutton">
</td>
</tr>
</cfif>
<cfif form.step eq 3>
<cftry>
<cfset payuid = "#CreateUUID()#">
<cfset invuid = "#CreateUUID()#">
<!---WRITE DATA TO TBLINV--->
<cfquery name="write_inv" datasource="#application.db#" result="test">
INSERT INTO tblpassInv
(INVVENDORID,INVREF,INVNAME,INVLNAME,INVTEL,INVEMAIL,INVADDR1,INVADDR2,INVCITY,INVREGION,INVCOUNTRY,INVZIP,INVCOMPANY,INVCREATEDBY,INVDATECREATED,INVACTIVE,INVSEND,paymentuid,invuid,invmasterpass,inviveri,invother,invpaymentdate)
VALUES
(#form.vendor#,'#form.REFNUM#','#form.NAME#','#form.LNAME#','#form.TEL#','#form.EMAIL#','#form.ADDR1#','#form.ADDR2#','#form.CITY#','#form.REGION#','#form.COUNTRY#','#form.ZIP#',#session.companyid#,#session.adminid#,#createodbcdatetime(now())#,1,0,'#payuid#','#invuid#',#form.MASTERPASS#,#form.IVERI#,#form.OTHER#,'#FORM.INVPAYMENTDATE#')
</cfquery>
<cfset NewPrimaryKey = test.GENERATED_KEY>
<!---<cfinclude template="inv_amend_prods_new.cfm">--->
<tr>
<td>
<table id="data">
<tr>
<td class="Copy" valign="top">Products/Line Items:</td>
<td>
</td>
</tr>
<tr>
<td class="Copy" valign="top">Item Name:</td>
<td>
<input type="text" class="validate[required]" name="Itemname1" id="Itemname1" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Item Description:</td>
<td>
<input type="text" class="validate[required]" name="ItemDesc1" id="ItemDesc1" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Quantity</td>
<td>
<input type="text" class="validate[required,custom[number]]" name="Quantity1" id="Quantity1" class="TextBlock">
</td>
</tr>
<tr>
<td class="Copy" valign="top">Product Code:</td>
<td><input type="text" class="validate[required]" name="Code1" id="Code1" class="TextBlock"></td>
</tr>
<tr>
<td class="Copy" valign="top">Price: (eg. 100.00)</td>
<td><input type="text" class="validate[required,custom[number]]" name="Price1" id="Price1" class="TextBlock"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<input type="Submit" name="Submit" value="Submit" class="submitbutton">
<input type="button" id="addnew" name="addnew" value="Add new item" />
<input type="hidden" id="items" name="items" value="1" />
<input type="hidden" name="step" value="4" />
<input type="hidden" name="invid" value="#NewPrimaryKey#" />
</td>
</tr>
<cfcatch type="any">
<script type="text/javascript">
alert("An error has occured! Please try again later")
</script>
</cfcatch>
</cftry>
</cfif>
<cfif form.step eq 4>
<cftry>
<cfloop from="1" to="#FORM.items#" index="i">
<cfset thisname = form["Itemname" & i]>
<cfset thisdesc = form["ItemDesc" & i]>
<cfset thisqty = form["Quantity" & i]>
<cfset thiscode = form["Code" & i]>
<cfset thisprice = form["Price" & i]>
<cfset thisprice = replace("#thisprice#",".","","All")>
<cfquery name="add_items" datasource="#application.db#">
INSERT INTO tblpassInvItems
(invid,itemactive,itemname,itemdesc,itemqty,itemcode,itemprice)
VALUES
(#form.invid#,1,'#thisname#','#thisdesc#',#thisqty#,'#thiscode#','#thisprice#')
</cfquery>
</cfloop>
<cfset invid = form.invid>
<cfinclude template="inv_doc.cfm">
<tr>
<td class="Copy" valign="top">Display all details for invoice:</td>
<td>
</td>
</tr>
<tr>
<td class="copy" valign="top">Download</td>
<td>Download</td>
</tr>
<tr>
<td>
<input type="Submit" name="Submit" value="Submit" class="submitbutton">
<input type="hidden" id="items" name="items" value="1" />
<input type="hidden" name="step" value="5" />
<input type="hidden" name="invid" value="#form.invid#" />
</td>
</tr>
<!---<cfheader name="Content-Disposition" value="attachment;filename=#this_filename#.pdf">
<cfcontent type="application/octet-stream" file="#expandPath('.')#/dynamicdocs/#this_filename#.pdf" deletefile="No">--->
<cfcatch type="any">
<script type="text/javascript">
alert("An error has occured! Please try again later")
</script>
</cfcatch>
</cftry>
</cfif>
<cfif form.step eq 5>
<tr>
<td class="Copy" valign="top" colspan="2">Please complete the following if you would like to send the invoice now or click on finish:</td>
</tr>
<tr>
<td class="Copy" valign="top">Bcc:</td>
<td>
<cfquery name="get_vendors" datasource="#application.db#">
SELECT * FROM tblpassVendor
WHERE vendorActive = 1
AND CompanyID = #session.companyid#
AND VendorID IN (#GetAdmin.AdminVendors#)
</cfquery>
<Select name="bcc">
<cfloop query="get_vendors">
<option value="#vendorbccemail#">#vendorbccemail#</option>
</cfloop>
</Select>
</td>
</tr>
<tr>
<td>
<input type="Submit" name="Submit" value="Submit" class="submitbutton">
<input type="hidden" id="items" name="items" value="1" />
<input type="hidden" name="step" value="6" />
<input type="hidden" name="invid" value="#form.invid#" />
</td>
</tr>
<tr>
<td>Save and Start New Invoice</td>
</tr>
</cfif>
<cfif form.step eq 6>
<cftry>
<cfset invid = form.invid>
<cfinclude template="inv_mail.cfm">
<tr>
<td class="Copy" valign="top" colspan="2">Thank you! Your Invoice has been sent!</td>
</tr>
<tr>
<td class="copy" valign="top"></td>
<td>Finish</td>
</tr>
<cfcatch type="any">
<tr>
<td class="Copy" valign="top" colspan="2">An Error has occured! Your invoice has not been sent</td>
</tr>
</cfcatch>
</cftry>
</cfif>
</cfoutput>
</table>
</form>
<cfinclude template="footer.cfm">
I am not using things like cfqueryparam as this is still being developed and is within a secure environment
Thank you in advance
I used to do something like this (used it long time back, code may be off, but more of an idea):
<cfparam name="form.submitted" default=0>
<cfif structKeyExists(FORM,"submit") AND NOT FORM.submitted>
<!---action code goes here--->
<cfset form.submitted=1>
</cfif>
<form>
<!--- your other form elements--->
<input type="hidden" name="submitted" value="#FORM.submitted#">
</form>
I am not sure, it can help you much in multi-step form, but it helped in single step avoiding multi-submit by setting the flag when the form has been submitted.
You can redirect to the same page, it will avoid re-posting the form.
I have faced similar kind of situation few days back. As per my knowledge the best possible solutions are,
Redirect to some other page for preventing form resubmission.
If redirect is not suitable , the only other option is using AJAX.

Error on radio buttons?

Getting error
Context validation error for tag cfinput.
The tag must be nested inside a cfform tag.
But I do have the form tag around the cfinput.
What could be causing the error?
Side note: before it use to be a select , but I would like to change it to a radio button.
<form method="post" action="cse_allusers_addcomment.cfm" name="add_comment">
<cfoutput>
<input type="hidden" name="txtSubmitter" value="#GetCurrentUser.emp_id#">
..more code...
</cfoutput>
<table>
<thead>
......
</thead>
<tbody>
<cfoutput>
<cfloop index="i" from="1" to="5">
<cfset question = GetEmployeeCSEDepts["csedept_question" & i][GetEmployeeCSEDepts.CurrentRow]>
<cfif question neq "">
<tr>
<td valign="top">
<cfinput type="radio" name="ratingradio" value="5">Exceptional<br>
<cfinput type="radio" name="ratingradio" value="4">Exceeds Standards<br>
<cfinput type="radio" name="ratingradio" value="3">Successful<br>
<cfinput type="radio" name="ratingradio" value="2">Needs Improvement<br>
<cfinput type="radio" name="ratingradio" value="1">Unsatisfactory<br>
<cfinput type="radio" name="ratingradio" value="0">N/A<br>
</td>
<td valign="top">#question#</td>
</tr>
</cfif>
</cfloop>
</cfoutput>
</tbody>
</table>
<cfoutput>
<p>
<br>
<textarea style="width:99%;" rows="3" name="txtPosComment"></textarea></p>
</cfoutput>
<p><input type="submit" name="Submit" value="Submit"></p>
</form>
You have it nested in a <form> tag but <cfinput> is expecting/requiring to be nested within a <cfform> tag.
By the way, why are you using <cfinput> tags anyway? You do not need to in the example given. Just use normal HTML <form> and <input> tags.