Re: loop over list question
Carl, Will Brian Kotek's FormUtils help only with the problem i was having earlyer. where it does this serial 101, 202, ticket no:5 model no: test, test2 an needs do this serial 101 ticket no: 5 model no:test serial 202 ticket no: 5 model no:test2 or will this help with my new problem of lets say they did this serial: 101 ticket no: 5 model no: serial: 202 ticket no: 5 model no: test if i leave model number blank in serial 101,an put a model no in 202. what will happen is it will put the model no from serial 202 in serial 101 and leave serial 202 blank. Thank you, Rachel ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309230 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: loop over list question
Well i wanted to thank both of you for the help, an i was able to solve my problem. By putting a counter in it i am able to accomplish my goal. the only thing i got to figure out is why it doesn't put the correct information into my 2nd serial. Like it i fill out 2 serial numbers and press submit, it puts the first line of information correct, however, where ever i have counter in my code, instead of putting what i put for the 2nd serial it puts what i put for the first serial. heres an example serial number: 61 ticket no:606 product type: all serial number: 61 ticket no:606 prodcut type: all (although i put desktop in here it says all like in the first one). but here is a copy of my code in case anyone else runs into a similar problem as me. again thank you both for helping me. cfloop index=x list=#Form.serialnum# delimiters=, cfset counter=1 CFQUERY Name=serial DataSource=CustomerSupport exec usp_CS_Insertserial '#x#','#Form.ID#','#Form.modelno#','#ListGetAt(Form.producttype,counter)#','#Form.softhardware#', '#Form.resolution#','#Form.resdate#','#Form.resvertified#','#Form.vertifidate#','#Form.deptvendor#','#Form.hardwarefailure#',' #Form.rma#' /CFQUERY cfset counter=counter+2 /CFLOOP ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309135 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: loop over list question
Here is the form i am working with. !--- Adds Multiple Ticket fields --- script type=text/javascript !---Allows us to add multiple fields --- function addInput(divName){ var dynamic = document.getElementById('dynamicInput'); var thevalue = document.getElementById('theValue'); var count = (document.getElementById('theValue').value -1)+ 2; thevalue.value = count; var newdiv = document.createElement('div'); var divIdName = 'dynamic'+count+'Input'; newdiv.setAttribute('id',divIdName); !--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure --- newdiv.innerHTML = table class='zpExpandedTable' id='modeltable' + th class='sectiontitletick' colspan='7'Serial Information + count + /th + tr + td id='paddingformultitop'Model No:nbsp;nbsp;nbsp;nbsp;/td + /td + td + select name='modelno' + option value=''Make A Selection/option + option value='Test'Test/option+ /select + /td + td + nbsp;nbsp;nbsp;nbsp;Product Type: + /td + td + select name='producttype' + option value='' selectedNo Choice/option + cfoutput query='getProdType' + option value='#pk_productType#'#pk_productType#/option + /cfoutput + /select + /td + td class='red' + nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;Type Of Hardware Failure*: + /td + td + select name='hardwarefailure' + option value='' selectedMake A Selection/option + cfoutput query='getHardwareFail' + option value='#pk_hardwareFailure#'#pk_hardwareFailure#/option + /cfoutput + /select + /td + /tr + table; !--- Adds Extra fields for Serial Number and Software/Hardware --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='modeltable' + tr + td id='paddingformultitop' + Serial Number:nbsp;nbsp; + input type='text' name='serialnum' + nbsp;nbsp;nbsp;nbsp;Software/Hardware:nbsp;nbsp; + input type='text' name='softhardware' + /td + /tr + /table; !--- Adds Extra fields for Description --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0' + tr + td id='paddingformutli' + Description:nbsp;nbsp; + /td + td class='descriptionmoveinmulti' + ( You may enter up to 500 characters. )+ br + textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)'rows='4' cols='60' name='description'/textarea + /td + /tr + /table; !--- Adds Extra fields for Resolution --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' + tr + td id='paddingformutli' + Resolution:nbsp;nbsp; + /td + td class='resolutionmoveinmulti' + ( You may enter up to 500 characters. )+ br + textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='resolution'/textarea + /td + /tr + /table; !--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0' + tr + td id='paddingformultitop' + Resolution Date:nbsp;(MM/DD/)nbsp;nbsp; + /td + td + input type='text' name='resdate' value='' nbsp;nbsp; + nbsp;nbsp;nbsp;nbsp;Current Date:nbsp;nbsp; + input type='checkbox' name='currentdateresol' id='currentresdate' onClick=resdate.value=fill_date() + /td + td + Resolution Verified as effective by:nbsp;nbsp; + /td + td + select name='resvertified' + option value=''Make A Selection/option + /select + /td + /tr + /table; !--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' + tr + td id='paddingformultitop' + Verification Date:nbsp;(MM/DD/)nbsp;nbsp; + /td + td class='vertificationmoveinmulti' + input type='text' name='vertifidate'nbsp;nbsp; + nbsp;nbsp;nbsp;nbsp;Current Date:nbsp;nbsp; + input type='checkbox' name='currentdatevert' onClick=vertifidate.value=fill_date() + /td + /tr + /table; !--- Adds Extra fields for Dept/Vendor Responsibility --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' + tr + td class='red' id='paddingformultitop' + Dept/Vendor Responsibility*:nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; + select name='deptvendor' + option value='' selectedMake A Selection/option + cfoutput query='getDeptVendor' + option value='#pk_deptVendor#'#pk_deptVendor#/option + /cfoutput + /select + /td + /tr + /table; !--- Adds Extra fields for RMA Data Only --- newdiv.innerHTML = newdiv.innerHTML + table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0' + tr + td id='paddingformultitop' + RMA Data Only:nbsp;nbsp;nbsp;nbsp; + /td + td class='rmanmoveinmulti' + ( You
Re: loop over list question
Carl, I did the cfdump and here is what i got CURRENTDATERESOL on,on CURRENTDATEVERT on,on DEPTVENDOR Shipping/Receiving,Shipper DESCRIPTION descr,descript FIELDNAMES ID,MODELNO,PRODUCTTYPE,HARDWAREFAILURE,SERIALNUM,SOFTHARDWARE,DESCRIPTION,RESOLUTION,RESDATE,CURRENTDATERESOL,RESVERTIFIED,VERTIFIDATE,CURRENTDATEVERT,DEPTVENDOR,RMA,MODELNO,PRODUCTTYPE,HARDWAREFAILURE,SERIALNUM,SOFTHARDWARE,DESCRIPTION,RESOLUTION,RESDATE,CURRENTDATERESOL,RESVERTIFIED,VERTIFIDATE,CURRENTDATEVERT,DEPTVENDOR,RMA HARDWAREFAILURE DOA,Infant Mortality ID 627 MODELNO modelnoTest,modelnoTest PRODUCTTYPE Accessory,Labtop RESDATE 7/16/2008 RESOLUTION resol,resolution RESVERTIFIED resolutionverttest,resolutionverttest RMA rma,rma test SERIALNUM 567,8910 SOFTHARDWARE soft,hard test VERTIFIDATE 7/16/2008 ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309153 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
loop over list question
Hey Everyone, well i been trying to figure this out for days but i am having no luck. In my form i am able to add multiple serial numbers an it all goes into the database with no problems. However, i need every serial number i add to create a new field an not go into the same field This is how it is going in there now serial number: 1234,223 next field: blah, blah2 an i need it to go into my database like serial number: 1234 next field: blah serial number: 223 next field: blah2 to accomplish this i been trying to loop over a list.Right now i am able to make the first field in my form (Form.serialnum) accomplish this. However, i can not get the rest of the fields to do this because of Form.ID. If i try to put the Form.ID in my list it says that i didn't declare it. however, if i leave it in my cfquery it works except it doesn't put any of the fields past ID into the database like i need it to. I admit i am not the best at coldfusion and i been trying, but i am just lost on where to go at this point. If you could tell me what i am doing wrong or have any suggestions i would very much appreciate it. The code i been trying it below Thank you to all who help. cfloop index=x list=#Form.serialnum# delimiters=, CFQUERY Name=serial DataSource=CustomerSupport exec usp_CS_Insertserial '#x#','#Form.ID#','#Form.modelno#','#Form.producttype#','#Form.softhardware#', '#Form.resolution#','#Form.resdate#','#Form.resvertified#','#Form.vertifidate#', '#Form.deptvendor#','#Form.hardwarefailure#','#Form.rma#' /CFQUERY /CFLOOP ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309063 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: loop over list question
Thank you greg for replying. I am pretty sure that there is nothing wrong with the database because the information still gets submitted in there. The way i have the cfloop now all the information still gets submitted into the database. Except, the problem is, is how it submits. This is how it submits serial number: 1 ID:3 model no: test, test1 serial number: 2 ID:3 model no: test, test1 when it gets to the model no and rest of fields it needs to be like this serial number: 1 ID:3 model no: test serial number: 2 id:3 model no: test1 but for some reason if i try to put the Form.ID out of cfquery an into the list it just gives me the error converting data type varchar to datetime. i thought it was giving me the didn't declare error, my bad. But if i was going to do it your way, loop over the list an create a list for each column in db, how would i go about that? pretty new to coldfusion so not really sure how i would do that. again thank you for all the help i really appreciate it. One way to troubleshoot this is to remove the cfquery and replace with cfoutput See what you're generating and passing to the DB Copy the output and place it in your DB GUI and run it.. You'll find out pretty quick if it's CF or the DB.. So you have all your fields in one huge list? You could loop over the list and create a list for each column for your DB.. If you know how many columns you are passing to the DB (which apparently you do), you could get a count of the entire list divided by the columns of your DB. Why are you using a store proc for inserting into your DB? Just use cfquery. Let me know if I need to explain anything else further.. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309095 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: loop over list question
Thank you greg for replying. I am pretty sure that there is nothing wrong with the database because the information still gets submitted in there. The way i have the cfloop now all the information still gets submitted into the database. Except, the problem is, is how it submits. This is how it submits serial number: 1 ID:3 model no: test, test1 serial number: 2 ID:3 model no: test, test1 when it gets to the model no and rest of fields it needs to be like this serial number: 1 ID:3 model no: test serial number: 2 id:3 model no: test1 but for some reason if i try to put the Form.ID out of cfquery an into the list it just gives me the error converting data type varchar to datetime. i thought it was giving me the didn't declare error, my bad. But if i was going to do it your way, loop over the list an create a list for each column in db, how would i go about that? pretty new to coldfusion so not really sure how i would do that. again thank you for all the help i really appreciate it. One way to troubleshoot this is to remove the cfquery and replace with cfoutput See what you're generating and passing to the DB Copy the output and place it in your DB GUI and run it.. You'll find out pretty quick if it's CF or the DB.. So you have all your fields in one huge list? You could loop over the list and create a list for each column for your DB.. If you know how many columns you are passing to the DB (which apparently you do), you could get a count of the entire list divided by the columns of your DB. Why are you using a store proc for inserting into your DB? Just use cfquery. Let me know if I need to explain anything else further.. ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:309096 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4