I have been searching all over for a way to only translate the contents of a text box.... but I can only find ways to translate the entire website.
Below is a sample of the page code of the form we'll be submitting. I would like to just translate the contents of textarea name="emergency_procedures".
<form action="#cgi.script_name#?submit=<cfif url.id neq "">UPDATE&id=#url.id#<cfelse>YES</cfif>" method="post">
<table id="keywordEditTable" class="editTable" cellpadding="0" cellspacing="0">
<tr>
<td class="editLabel"><span>*</span>Type Title:</td>
<td class="editField">
<input type="text" name="name"<cfif url.id neq "">value="#trim(item.name)#"</cfif> size="35" />
</td>
</tr>
<tr>
<td class="editLabel"><span>*</span>Active:</td>
<td class="editField">
<input type="radio" name="active"<cfif url.id eq "" or item.active eq 1> checked="checked"</cfif> value="1" />
<label for="active">Yes</label>
<input type="radio" name="active"<cfif url.id neq "" and item.active neq 1> checked="checked"</cfif> value="0" />
<label for="active">No</label>
</td>
</tr>
<tr>
<td class="editLabel"><span>*</span>Default:</td>
<td class="editField">
<input type="radio" name="is_default"<cfif url.id eq "" or item.is_default eq 1> checked="checked"</cfif> value="1" />
<label for="active">Yes</label>
<input type="radio" name="is_default"<cfif url.id neq "" and item.is_default neq 1> checked="checked"</cfif> value="0" />
<label for="active">No</label>
</td>
</tr>
<tr id="editLastRow">
<td class="editLabel">Emergency Procedures:</td>
<td class="editField"><textarea name="emergency_procedures" cols="67" rows="15"><cfif url.id neq "">#item.emergency_procedures#</cfif></textarea></td>
</tr>
<cfif url.id neq "">
<tr id="editLastRow">
<td class="editLabel"></td>
<td class="editField">
</td>
</tr>
</cfif>
<tr>
<td class="editLabel"><span>*</span>Notify URL:</td>
<td class="editField">
<input type="text" name="notify_url"<cfif url.id neq "">value="#item.notify_url#"</cfif> size="65" />
</td>
</tr>
<tr>
</tr>
<tr>
<td></td>
<td id="editButtons">
<input type="submit" name="Make" value="<cfif url.id neq "">Update<cfelse>Create</cfif>" id="editButton" />
<cfif url.id neq "">
<input type="button" name="Delete" value="Delete" id="deleteButton" onclick="confirmDelete()" />
<input type="hidden" name="id" value="#url.id#" />
</cfif>
<input type="button" name="Cancel" value="Cancel" id="cancelButton" onclick="document.location='EMB_types.cfm'" />
</td>
</tr>
</table>
</cfoutput>
This is too long for a comment, but here goes. You want to use Google's REST API and / http. I haven't programmed out all the details but this should get you started
<cfscript>
endpoint = "https://translation.googleapis.com/language/translate/v2";
if (cgi.request_method == "POST") {
httpService = new http();
httpService.setMethod("post");
httpService.setCharset("utf-8");
httpService.setUrl(endpoint);
httpService.addParam(type="formfield", name="q", value= form.emergency_procedures);
httpService.addParam(type="formfield",name="target",value="yourlanguage");
httpService.addParam(type="formfield",name="key",value="yourkey");
result = httpService.send().getPrefix();
writedump(result);
}
</cfscript>
You are probably going to have tinker with the fields to get to work right. Currently the REST API documentation is at: https://cloud.google.com/translate/docs/reference/rest/v2/translate
I have a form which takes in the values of First Name, Last Name and DOB. I have two tables: TableA and TableB. Each table may contain information of the person name that is entered in the form. What I would like to do, in ColdFusion, write a query where I take the user inputs and compare which Table contains the info. Once I find which table contains the user info, display particular columns that pertain in that table.
Below is the form:
<Form name="ERHospital" Method="Post" class="a">
<div align="center" style="margin-top:10pt; margin-bottom:10pt">
<table Border="0" width="100%" align="center" cellpadding=0 cellspacing=0 >
<tr>
<td class="m" id="fName">First Name </td>
<td>
<input class="a" id="FirstName" name="FirstName" value="<cfoutput></cfoutput>" size="15">
</td>
<td class="m" id="lName">Last Name </td>
<td>
<input class="a" id="LastName" name="LastName" value="<cfoutput></cfoutput>" size="15">
</td>
<td class="m" id="DOB">
DOB<br />
<font color="##CC0000" size="1" style="italic">(mm/dd/yyyy)</font>
</td>
<td>
<input type="text" id="BirthDt" name ="BirthDt" id="BirthDt" maxlength="10" size="10">
</td>
</tr>
<tr>
<!---<td class="m" id="Hospital">Hospital</td>
<td>
<select name="hosp" id="hosp"></select>
</td>--->
<!---<td class="m" colspan="2"></td>
<td class="m">
<input type="button" value="Submit" onClick="SubmitMe(); checkFields();" name="SubmitEmpBtn" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold">
</td>
<td align="left">
<input type="button" name="Clear" value="Clear" onClick="ClearForm()" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold">
</td>
</tr>--->
</table>
<div style="text-align:center; margin-top:15pt"><input type="button" value="Submit" onClick="SubmitMe(); checkFields();" name="SubmitEmpBtn" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold"> <input type="button" name="Clear" value="Clear" onClick="ClearForm()" style="font-size:12px; font-family:Arial, Helvetica, sans-serif; font-weight:bold"> </div>
<!---<table align="center">
<TR>
<TD align="center"><input type="button" value=" Submit " onClick="SubmitMe()" name="SubmitEmpBtn" style="font-size:14px; font-family:Arial, Helvetica, sans-serif"> <input type="button" name="Clear" value=" Clear " onClick="ClearForm()" style="font-size:14px; font-family:Arial, Helvetica, sans-serif"> </td>
</tr>
</table>
</table>--->
</div>
</FORM>
If the user is guaranteed to be in only one table, then you can use a UNION ALL like the following:
<cfquery name="myquery" datasourse="#myDSN#">
SELECT <userField1>, <userField2>
FROM Table1
WHERE
FirstName = <cfqueryparam value="#form.firstname#" cfsqltype="cf_sql_varchar">
AND
LastName = <cfqueryparam value="#form.lastname#" cfsqltype="cf_sql_varchar">
UNION ALL
SELECT <userField1>,<userField2>
FROM Table2
WHERE
FirstName = <cfqueryparam value="#form.firstname#" cfsqltype="cf_sql_varchar">
AND
LastName = <cfqueryparam value="#form.lastname#" cfsqltype="cf_sql_varchar">
</cfquery>
If the user is only in one table, you'll only get the results for your requested user.
EDIT: I would also add that I am not a big fan of using form, url or any other external variable in a sql query without making sure they have been sanitized. But that is a WHOLE different type of discussion. :-)
I have a page with this basic process:
Click checkboxes next to forms you want to download
Click submit
CFWindow pops up to collect some basic info
Click submit to download forms while staying in the window that was opened by CFWindow
When you click the submit button inside the CFWindow , it brings you back to the parent page. I want the form submission to stay inside the CFWindow. I saw this post: Refresh cfwindow content. However, the refreshOnShow = "true" does not work. Every time I hit submit, it goes back to the parent window.
Here is the Parent page:
<cfform name="myform">
<cfinput type="hidden" name="OrgID" value="#getit.orgID#">
<table width="95%" border="0" cellspacing="5" cellpadding="0" align="center">
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td width="50%" valign="top" class="coretextforBR">
<cfinput type="checkbox" name="GetThese" value="#form_ID#">
<a class="corelinkforBR">#Forms_Name#</a>
<br /><br />
#Forms_Description#
<br /><br />
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit"value="Get It" onclick="javascript:ColdFusion.Window.show('mywindow1')">
</td>
</tr>
</table>
</cfform>
<cfwindow x="250" y="250" width="400" height="400"
name="mywindow1" title="Almost ready to download" initshow="false" draggable="false" resizable="false"
refreshOnShow="true" source="submitform.cfm?GetThese={myform:GetThese.value}&OrgID={myform:OrgID}&action=information"
bodystyle="background-color: white;" headerStyle="background-color: ###getcss.color#; font-family: #getcss.font#; color: ###getcss.fontcolor#;" />
Here is the source (submit.cfm) for the CFWwindow:
<cfparam name="attributes.action" default="information">
<cfoutput>
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
This window will collect information to begin download
<br>
<!--- action for downloading --->
<cfif attributes.action eq "download">
<cfloop info and stuff left out>
#Forms_Name#<br />
</cfloop>
<!--- what you see when page initially loads --->
<cfelse>
<form action="submitform.cfm?action=download" method="post">
<input type="hidden" name="GetThese" value="#attributes.GetThese#">
<input type="hidden" name="OrgID" value="#attributes.OrgID#">
<table width="95%" border="0" align="center">
<tr>
<td class="coretextforBR">First:</td>
<td><input type="text" name="CollectedInfo_First"></td>
</tr>
<tr>
<td class="coretextforBR">Last:</td>
<td><input type="text" name="CollectedInfo_Last"></td>
</tr>
<tr>
<td class="coretextforBR">Phone:</td>
<td><input type="text" name="CollectedInfo_Phone"></td>
</tr>
<tr>
<td class="coretextforBR">Email:</td>
<td><input type="text" name="CollectedInfo_Email"></td>
</tr>
<tr>
<td class="coretextforBR">Best way <br> to contact:</td>
<td><input type="text" name="CollectedInfo_BestWay"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Download" class="button one"></td>
</tr>
</table>
</form>
</cfif>
</cfoutput>
</body>
</html>
I have no idea what I am doing wrong. I couldn't find a definite answer to my problem either other than the refreshOnShow. Should I rethink and do a ajax submit?
Using <cfform> instead of normal <form> worked as Liegh suggested.
I have an HTML page with a table of checkboxes. Each checkbox has a name.
In col1 is the checkbox. In col2 is the name.
I want to find the checkbox which has the name "Address"
I have managed to find it by using the following Xpath:
//table[#id="reporting_add_report_tab_manual_ct_vars_usn"]/tbody//tr//td//div[contains(text(), "Address")]//ancestor::tr[1]//input[#type="checkbox"]
I locate the column which contains the text "Address"
I then use ancestor to go up 1 row to it's parent of the current node and locate the checkbox
I would like to use CSS, can this xpath be converted to use the CSS locator?
CSS is quicker than Xpath to locate elements on the web page.
The HTML is:
<table id="reporting_add_report_tab_manual_ct_vars_usn" class="GJPPK2LBJE" cellspacing="0" __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true">
<thead aria-hidden="false">
<colgroup>
<tbody style="">
<tr class="GJPPK2LBCD GJPPK2LBJD" __gwt_subrow="0" __gwt_row="0">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBED GJPPK2LBKD">
<div __gwt_cell="cell-gwt-uid-1204" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBKD">
<div __gwt_cell="cell-gwt-uid-1205" style="outline-style:none;">Name</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBKD">
<div __gwt_cell="cell-gwt-uid-1206" style="outline-style:none;">
<select tabindex="-1">
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBKD">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBOD GJPPK2LBKD">
</tr>
<tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="1">
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-1204" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE">
<div __gwt_cell="cell-gwt-uid-1205" style="outline-style:none;">Address</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDE">
<td class="GJPPK2LBBD GJPPK2LBDE">
<td class="GJPPK2LBBD GJPPK2LBDE GJPPK2LBOD">
</tr>
<tr class="GJPPK2LBCD" __gwt_subrow="0" __gwt_row="2">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBED">
<div __gwt_cell="cell-gwt-uid-1204" style="outline-style:none;">
<input type="checkbox" tabindex="-1"/>
</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD">
<div __gwt_cell="cell-gwt-uid-1205" style="outline-style:none;">DOB</div>
</td>
<td class="GJPPK2LBBD GJPPK2LBDD">
<td class="GJPPK2LBBD GJPPK2LBDD">
<td class="GJPPK2LBBD GJPPK2LBDD GJPPK2LBOD">
</tr>
<tr class="GJPPK2LBCE" __gwt_subrow="0" __gwt_row="3">
</tbody>
<tbody style="display: none;">
<tfoot style="" aria-hidden="false">
</table>
If the order of the checkboxes is fixed you can use nth-of-type
input[type='checkbox']:nth-of-type(2)
This will find the second occurrence of input[type='checkbox'].
Or you can use nth-child.
table#reporting_add_report_tab_manual_ct_vars_usn tr:nth-child(2) td input
This finds the second tr in the table, in that row a td with an input.
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.