House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

I doubt anyone can help me with this, but

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
...I'm writing a CF app. for a client that wants to be able to have his input form look exactly like his invoice. Because of this, the form on the page HAS to be an HTML form. (it would be nearly impossible for me to make a flash form look the way they need it to) However, the form also needs to have a flash grid to display the work done and the grid needs to update the totals in the last field of the grid based on quantity and price. Also, the entire total from the grid needs to be updated in the subtotal field. I managed to find some good code here: "http://www.asfusion.com/blog/entry/adding-the-values-of-a-cfgrid-column". This code works fine on it's own (probably because it's all in one flash form) but when I try to incorporate it into the app., it won't show the grid at all on the page. (because the form is an HTML form and the grid is a Flash grid) My "solution" was to create 3 separate forms on the page, 2 HTML forms for the regular input fields and one flash form in between them to supply the flash grid and I'm using JavaScript to compile the controls from all of the forms to create a new form containing all of the fields and submitting it. Well, that ALMOST works. Only some of the fields are getting sent to the processing page and NONE of the flash form fields are being sent. Also, I can't get the subtotal field to accept the variable that the JavaScript created that contains the total of all rows because the variable can't be passed from one form to another on the same page. (especially passing it from a Flash form to an HTML form)
Ray Meade
02/22/12 03:26 P
On Wed, Feb 22, 2012 at 2:36 PM, Camer
Raymond Camden
02/22/12 03:51 P
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ray Meade
02/22/2012 03:26 PM

...I'm writing a CF app. for a client that wants to be able to have his input form look exactly like his invoice. Because of this, the form on the page HAS to be an HTML form. (it would be nearly impossible for me to make a flash form look the way they need it to) However, the form also needs to have a flash grid to display the work done and the grid needs to update the totals in the last field of the grid based on quantity and price. Also, the entire total from the grid needs to be updated in the subtotal field. I managed to find some good code here: "http://www.asfusion.com/blog/entry/adding-the-values-of-a-cfgrid-column". This code works fine on it's own (probably because it's all in one flash form) but when I try to incorporate it into the app., it won't show the grid at all on the page. (because the form is an HTML form and the grid is a Flash grid) My "solution" was to create 3 separate forms on the page, 2 HTML forms for the regular input fields and one flash form in between them to supply the flash grid and I'm using JavaScript to compile the controls from all of the forms to create a new form containing all of the fields and submitting it. Well, that ALMOST works. Only some of the fields are getting sent to the processing page and NONE of the flash form fields are being sent. Also, I can't get the subtotal field to accept the variable that the JavaScript created that contains the total of all rows because the variable can't be passed from one form to another on the same page. (especially passing it from a Flash form to an HTML form) Here's the JavaScript that updates the last column in the grid and calculates the total: <cfscript>   products=queryNew("");   names="";   amount=0;   price=0;   quantity=0;   queryaddcolumn(products,"name",listtoarray(names));   queryaddcolumn(products,"amount",listtoarray(amount));     queryaddcolumn(products,"quantity",listtoarray(quantity));   queryaddcolumn(products,"price",listtoarray(price));   </cfscript> <cfsavecontent variable="calculateTotal">   var totalAmount = 0;   var item;   var subTotal = 0;   for(var i = 0; i < cart.length; i++) {     item = cart.getItemAt(i);     subTotal = number(item['price']) * item['quantity'];     totalAmount += subTotal;     cart.editField(i, 'amount', subTotal);   }   total.text = totalAmount; </cfsavecontent> Here's the script that compiles the 3 forms into 1 and submits it: <script language="JavaScript" type="text/javascript"> /* Function: add all elements from ``frmCollectFrom´´ and append them to ``frmCollector´´ before returning ``frmCollector´´*/ function appendFormVals2Form(frmCollectFrom, frmCollector) { var frm = frmCollectFrom.elements; for(var ix = 0 ; ix < frm.length ; ix++) frmCollector.appendChild(frm[ix]); return frmCollector; } /* Collect all forms in document to one and post it */ function submitAllDocumentForms() { var arrDocForms = document.getElementsByTagName('form'); var formCollector = document.createElement("form"); with(formCollector) { method="post"; action="processes/newprocess_manageproject.cfm"; name="formCollector"; id="formCollector"; } for(var ix=0;ix<arrDocForms.length;ix++) { appendFormVals2Form(arrDocForms[ix], formCollector); } document.body.appendChild(formCollector); formCollector.submit(); } </script> And here are the 3 forms I'm using on the page: <cfform name="myForm1" format="html" width="850" height="250"> <table width="829" border="0" align="center" cellpadding="2" cellspacing="2">   <tr>   <td width="158" rowspan="2" align="left" valign="top"><img src="images/mainlogo.jpg" width="158" height="151" /></td>   <td colspan="3" align="left" valign="top"><span class="style21"><u>#qCompanyInfo.CompanyName#</u></span></td>   </tr>   <tr>     <td colspan="2"><span class="style12">#qCompanyInfo.CompanyAddress#<br />#qCompanyInfo.CompanyCity#, #qCompanyInfo.CompanyState# #qCompanyInfo..CompanyZip#<br />#qCompanyInfo.CompanyPhone#</span><br /><span class="style15">#qCompanyInfo.CompanyWebsite#</span></td>     <cfif IsDefined("url.vid")><td width="100" align="right" valign="top"><table align="right" width="110" border="0" class="style3"><tr><td><span class="style3" style="text-align:right;">#qVehicle.VehicleYear#<br />#qVehicle.VehicleMake#<br />#qVehicle.VehicleModel#</span></td></tr></table></td></cfif>   </tr>   <tr height="60">     <td colspan="3" align="left" valign="top"><div class="style2" style="float:left; clear:left; width:610px; text-align:center"><u>"We'll fix it right and save you money too!"</u></div>   </td>       <td width="154" valign="bottom" class="style3">Project Name:<br /><cfinput name="ProjectName" type="text" size="20"></td>   </tr> </table> <table width="800" border="0" align="center" cellspacing="2" bordercolor="##0099FF">   <tr>     <td width="395" height="21" align="left" valign="bottom" class="style1">         Valued Customer:     </td>     <td width="395" align="left" valign="bottom" class="style1">Vehicle Info:</td>   </tr>   <tr>     <td height="140" valign="top" bordercolor="##0FF">     <table width="100%" height="220" border="1" bordercolor="##0099FF">     <tr>       <cfif IsDefined("url.id")>     <td width="400" align="left" valign="top" class="monkeythink">       <div class="jtextfill" style="width:390px; height:67px; float:left"><span class="dyntextval style14">#qClient.CustomerName#</span></div> </div> <div style="width:400px; height:25px; clear:left">   <div class="style22" style="width:70px; height:32px; float:left">Address:</div><div class="style22" style="width:330px; float:left">#qClient..Address#</div> </div> <div class="monkeythink" style="width:400px; height:25px; clear:left">   <div class="style22" style="width:70px; height:32px; float:left">City:</div><div class="style22" style="width:140px; float:left">#qClient.City#</div><div class="style22" style="width:50px; height:32px; float:left">State:</div><div class="style22" style="width:40px; height:32px; float:left">#qClient.Region#</div><div class="style22" style="width:40px; height:32px; float:left">Zip:</div><div class="style22" style="width:60px; height:32px; float:left">#qClient.PostalCode#</div> </div>   <div style="width:400px; height:25px; clear:left">           <div class="style22" style="width:70px; height:30px; float:left">Phone:</div><div class="style22" style="width:140px; height:32px; float:left">#qClient.Phone#</div><div class="style22" style="width:55px; height:32px; float:left">Cell:</div><div class="style22" style="width:130px; height:32px; float:left">#qClient.Fax#</div>     </td>   <cfelse>         <td align="left" valign="top">       <span class="style22">Customer: <cfinput name="CustomerName" type="text" size="45"></span><br>       <span class="style22">Address:<br /><cfinput name="Address" type="text" size="60"></span><br />       <span class="style22">City: <cfinput name="City" type="text" size="25"></span><br />       <span class="style22">State: <cfinput name="Region" type="text" size="15"></span><br>       <span class="style22">Zip Code: <cfinput name="PostalCode" type="text" size="25"></span><br>       <span class="style22">Phone: <cfinput name="Phone" type="text" size="12" validate="telephone" mask="(999) 999-9999"> | Cell/Other: <cfinput name="Fax" type="text" size="12" validate="telephone" mask="(999) 999-9999"></span>     </td>   </cfif>     </tr>     </table>     </td>     <td valign="top">       <table width="100%" height="220" border="1" bordercolor="##0099FF">     <tr>     <td>   <cfif IsDefined("url.vid")>       <table width="400" cellpadding="2" cellspacing="2">   <tr>     <td>     <table height="166" width="400" border="0">       <tr>         <td width="67" align="left" valign="bottom" class="style18">Date:</td>         <td colspan="3" align="left" valign="bottom" class="style17"><cfinput name="ProjectDate" type="text" size="25" value="#DateFormat(Now(), 'mm/dd/yyyy')#"></td>         </tr>       <tr>         <td align="left" valign="bottom" class="style22">Vehicle:</td>         <td colspan="3" align="left" valign="bottom" class="style22">#qVehicle.VehicleYear# #qVehicle.VehicleMake# #qVehicle.VehicleModel#</td>         </tr>       <tr>         <td align="left" valign="bottom" class="style22">Color:</td>         <td width="133" align="left" valign="bottom" class="style22">#qVehicle.VehicleColor#</td>         <td width="67" align="left" valign="bottom" class="style22">Engine:</td>         <td width="115" align="left" valign="bottom" class="style22">#qVehicle.VehicleEngine#</td>       </tr>       <tr>         <td align="left" valign="bottom" class="style22">Mileage:</td>         <td align="left" valign="bottom" class="style22"><cfinput type="text" size="20" name="Mileage" id="Mileage" value="#qVehicle.VehicleMileage#"></td>         <td align="left" valign="bottom" class="style22">Plate:</td>         <td align="left" valign="bottom" class="style22">#qVehicle.VehicleLicenseNumber#</td>       </tr>       <tr>         <td align="left" valign="bottom" class="style22">VIN:</td>         <td colspan="3" align="left" valign="bottom" class="style22">#qVehicle.VehicleVIN#</td>         </tr>     </table></td>   </tr> </table>     <cfelse>           <span class="style22">Project Date: <cfinput name="ProjectDate" type="text" size="25" value="#DateFormat(Now(), 'mm/dd/yyyy')#"></span><br />       <span class="style22">Year: <cfinput name="VehicleYear" type="text" size="15"> Color: <cfinput name="VehicleColor" type="text" size="15"></span><br />       <span class="style22">Make: <cfinput name="VehicleMake" type="text" size="30"></span><br />       <span class="style22">Model: <cfinput name="VehicleModel" type="text" size="30"></span><br />       <span class="style22">Engine: <cfinput name="VehicleEngine" type="text" size="30"></span><br />       <span class="style22">Mileage: <cfinput name="VehicleMileage" type="text" size="15"></span><br />       <span class="style22">Plate: <cfinput name="VehicleLicenseNumber" type="text" size="15"></span><br />       <span class="style22">VIN ##: <cfinput name="VehicleVIN" type="text" size="40"></span>     </cfif>     </td>     </tr>     </table>     </td>   </tr>   </table>   <table width="832" border="0" align="center"> <tr> <td> <table width="829" border="1" cellpadding="10" bordercolor="##0099FF"><tr><td width="801" align="left" valign="top">     <span class="style5">I authorize Budget Transmission Center, LLC to perform the repairs below and furnish necessary materials. I understand any cost quoted is an estimate. Budget employees may operate the vehicle for inspection, testing and delivery and may park the vehicle in the parking lot. Budget will not be responsible for loss or damage to the vehicle or articles left in it, in the case of fire, theft or any other reason not caused by Budget. Vehicles left overnight are at owners risk. I understand that Budget is not assuming any responsibility for theft or damage to the vehicle at any time when the vehicle is not inside Budget's building or being driven by Budget. An express mechanics lien is acknowledged on the above vehicle to secure payment for work performed under a written repair estimate. I accept and do realize this is a non cancelable contract and that by signing I have read all the terms on this invoice. Storage will start 5 days after completion of work at $30.00 per day. Abuse of any kind including getting stuck in snow will void warranty.</span><br />     <span class="style3">Signed: x ______________________________________________________________________</span></td></tr></table>     </td>     </tr>     </table> </cfform> </cfoutput> <table width="700" align="center"> <tr> <td> <cfform name="myForm" format="flash" width="850" height="270"> <cfformgroup type="vBox">   <cfgrid name="cart" query="products" format="flash" width="820" selectMode="edit" onchange="#calculateTotal#" insert="yes" delete="yes" italic="no" bold="no" gridLines="yes" colHeaders="yes" colHeaderItalic="no" colHeaderBold="yes" enabled="Yes" visible="Yes" rowheaders="no">   <cfgridcolumn name="quantity" header= "Qty." Select="Yes" type="numeric" width="50" textcolor="##003366" bold="No" dataalign="left" headeralign="center" headerbold="yes" headertextcolor="##003366">   <cfgridcolumn name="name" header="Description" Select="Yes" width="600" textcolor="##003366" bold="No" dataalign="left" headeralign="center" headerbold="yes" headertextcolor="##003366">   <cfgridcolumn name="price" header="Cost" select="Yes" width="100" textcolor="##003366" bold="No" dataalign="left" headeralign="center" headerbold="yes" headertextcolor="##003366">             <cfgridcolumn name="amount" header="Subtotal" type="currency" dataalign="right"  select="false" width="60">   </cfgrid>     <cfinput type="Text" name="total" visible="false" disabled="true" size="5" style="disabledColor:Black; borderStyle:none; fontWeight:bold;">   </cfformgroup> </cfform> </td> </tr> </table> <cfform name="myForm2" format="html" width="850" height="250"> <table width="800" border="0" align="center">   <tr>     <td height="43" colspan="2" valign="top"><span class="style9">Warranty:       <cfinput type="checkbox" name="NinetyDay3000Mile" value="yes" id="NinetyDay3000Mile">       90 Days/3,000 Miles       <cfinput type="checkbox" name="SixMonth6000Mile" value="yes" id="SixMonth6000Mile">       6 Months/6,000 Miles       <cfinput type="checkbox" name="TwelveMonth12000Mile" value="yes" id="TwelveMonth12000Mile">       12 Months/12,000 Miles</span><br />       <span class="style16">Notes:</span>       <br />       <cftextarea name="ProjectNotes" cols="65" rows="4" label="Notes" style="text-align:left" height="65" width="375" value="Thank you from all of us here at Budget Transmission Center!!!" />     </td>         <td width="100" colspan="2" rowspan="2" align="center" valign="middle">     <table align="right">     <tr>       <td><table border="0" align="right">           <tr align="right" height="15">             <td height="23" valign="top"><span class="style22"><cfinput type="checkbox" name="Taxable" id="Taxable" value="checkbox" checked="yes">Taxable? </span></td>           </tr>           <tr height="15">             <td align="right"><span class="style23" style="text-align:right">Subtotal: </span></td>           </tr>           <tr height="15">             <td align="right"><span class="style23" style="text-align:right">CT <cfoutput>#qCompanyInfo.SalesTax#</cfoutput>% Tax: </span></td>           </tr>           <tr height="15">             <td align="right"><span class="style23" style="text-align:right">Deposit/Discount: </span></td>           </tr>           <tr height="25">             <td> </td>           </tr>           <tr height="15">             <td height="25" align="right" valign="bottom"><span class="style16" style="text-align:right"><strong>Total:</strong> </span></td>           </tr>         </table></td>       <td><table width="45" align="right" border="1" bordercolor="##0099FF">           <tr align="right" height="15">             <td bgcolor="##66CCFF" width="40"> </td>           </tr>           <tr height="15">             <td bgcolor="##66CCFF" align="right" width="40"><span class="style24" style="text-align:right"><cfinput type="Text" name="total" disabled="true" size="15" style="background-color:##66CCFF; border:none; border-style:none; text-align:right"> </span></td>           </tr>           <tr height="15">             <td bgcolor="##66CCFF" align="right" width="40"><span class="style24" style="text-align:right"> </span></td>           </tr>           <tr height="15">             <td bgcolor="##66CCFF" align="right" width="40"><span class="style24" style="text-align:right"><cfinput type="text" name="deposit" id="deposit" size="15" style="background-color:##66CCFF; border:none; border-style:none; text-align:right"></span></td>           </tr>           <tr height="15">             <td bgcolor="##66CCFF" width="40"> </td>           </tr>           <tr height="15">             <td bgcolor="##66CCFF" align="right" width="40"><span class="style24" style="text-align:right; font-weight:bold"> </span></td>           </tr>         </table></td>     </tr>   </table>       </td>         </tr>   <tr>     <td colspan="3"> </td>     </tr>   <tr>     <td width="373" height="27" align="center" valign="top">     <cfinput name="AddProject" type="button" value="Add Job" onclick="submitAllDocumentForms();">     <cfinput name="PrintInvoice" type="button" value="Print Invoice" onclick="submitAllDocumentForms();">     <cfinput name="Cancel" type="button" value="Cancel" onClick="window.location='index.cfm'">     </td>     </tr> </table> </cfform> I've been pulling what little hair I have left out over this issue so naturally any help anyone can give me would be GREATLY appreciated.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Cameron Childress
02/22/2012 03:36 PM

> ...I'm writing a CF app. for a client that wants to be able to have his > input form look exactly like his invoice. Because of this, the form on the > page HAS to be an HTML form. (it would be nearly impossible for me to make > a flash form look the way they need it to) This could also be a good case for PDF forms. > However, the form also needs to have a flash grid to display the work done I suspect you will have an easier time using HTML/JS/CSS for this.  Look at jQuery, there are several skinable datagrids available as plugins. > My "solution" was to create 3 separate forms on the page, 2 HTML forms for > the regular input fields and one flash form in between them to supply the > flash grid and... > This will probably make you insane eventually. > I've been pulling what little hair I have left out over this issue so > naturally any help anyone can give me would be GREATLY appreciated. If it doesn't make you insane, it might make you bald. Just use HTML/jQuery. -Cameron -- Cameron Childress -- p:   678.637.5072 im: cameroncf facebook <http://www.facebook.com/cameroncf>; | twitter<http://twitter.com/cameronc>; | google+ <https://profiles.google.com/u/0/117829379451708140985>;

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
02/22/2012 03:51 PM

On Wed, Feb 22, 2012 at 2:36 PM, Camer ----- Excess quoted text cut - see Original Post for more ----- Or just remind the client that the web isn't print. Period. Deal with it. Etc. I mean, shoot, does he want your code to also transform user's monitors into legal US paper size and thickness? Ditto Cam - just use HTML/jQuery. :)

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ray Meade
02/22/2012 04:38 PM

Thanks guys, I'll give jquery a try. And to Ray, I think if I have to spend much more time on this, I'm going to have to explain it to him. The only reason he's being so picky is because he was using MS Access before the conversion and he expects the CF app. to work exactly the same way except for the look of the input form. He actually told me he wanted the app. to update the database on the fly like MS Access does so that if anything goes wrong while entering in data, he won't have to type everything in again. It took me forever to convince him that not only would it require accessing and updating the database after each keystroke and would greatly slow down the app., but that having corrupt and/or incomplete data in a database is just bad coding. He's a great guy, but he's one of "those" clients...you know, the ones that want the near impossible.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Captain Obvious
02/22/2012 04:49 PM

Just charge for the labor accordingly... Have managed to talk clients out of all sorts of outlandish impulses by bringing up the costs ($ or time or both). Questions that start with "Can we [some technical thing]?" can usually be answered "Yes, given [required resources]." The more interesting question is often "How best should we [some technical thing] given currently available resources\workflows\future plans\etc]?"

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
02/22/2012 04:55 PM

I remember, with great joy, telling one such client what their video streaming requirements would actually cost them. (I think it was around 750K or so for Flash Media Servers.) > > Just charge for the labor accordingly... Have managed to talk clients out > of all sorts of outlandish impulses by bringing up the costs ($ or time or > both). Questions that start with "Can we [some technical thing]?" can > usually be answered "Yes, given [required resources]." The more interesting > question is often "How best should we [some technical thing] given > currently available resources\workflows\future plans\etc]?"

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
02/22/2012 04:53 PM

You -can-, however, use a client side solution to store the form values - in case of browser crash or something else. :) > > Thanks guys, I'll give jquery a try. And to Ray, I think if I have to spend much more time on this, I'm going to have to explain it to him. The only reason he's being so picky is because he was using MS Access before the conversion and he expects the CF app. to work exactly the same way except for the look of the input form. He actually told me he wanted the app. to update the database on the fly like MS Access does so that if anything goes wrong while entering in data, he won't have to type everything in again. It took me forever to convince him that not only would it require accessing and updating the database after each keystroke and would greatly slow down the app., but that having corrupt and/or incomplete data in a database is just bad coding. He's a great guy, but he's one of "those" clients...you know, the ones that want the near impossible.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Cameron Childress
02/22/2012 04:56 PM

> Thanks guys, I'll give jquery a try. And to Ray, I think if I have to > spend much more time on this, I'm going to have to explain it to him. I obvious don't know your client, but in my experience, you will always EVENTUALLY have to explain it. A huge part of dealing with clients is setting proper expectations. If you set the expectation that it's possible to make the online app look and behave identically to a MS Access database, you're gonna run into trouble eventually. It's better to be up front as early as possible than you try to satisfy a client's unreasonable expectations because you allowed those expectations to be set by the client without control by you, the developer. -Cameron -- Cameron Childress -- p:   678.637.5072 im: cameroncf facebook <http://www.facebook.com/cameroncf>; | twitter<http://twitter.com/cameronc>; | google+ <https://profiles.google.com/u/0/117829379451708140985>;

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Ray Meade
02/22/2012 05:43 PM

By the way, is there a way to grab the variables created by cfsavecontent? When I try to access the variable calculateTotal.totalAmount, I get the "You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members." error message which means I'm trying to use a string as a structure. When I use a cfdump to dump calculateTotal, it just shows me the entire code in one long string like so: "var totalAmount = 0; var item; var subTotal = 0; for(var i = 0; i < cart.length; i++) { item = cart.getItemAt(i); subTotal = number(item['price']) * item['quantity']; totalAmount += subTotal; cart.editField(i, 'amount', subTotal); } total.text = totalAmount;" Is it not possible to reference the variables in a cfsavecontent?

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Raymond Camden
02/22/2012 05:49 PM

You didn't create those variables. You created a string. If you output caculateTotal, you will see the literal text you wrote, not variables. ----- Excess quoted text cut - see Original Post for more -----


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

May 24, 2012

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
     1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31     

Designer, Developer and mobile workflow conference