displaying previously entered multiple fields | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| |
Hey Everyone,
Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place.
what i am trying to display previously entered multiple fields. I am able to get my serial fields to display correctly, but i can not display my parts fields correctly.
Currently this is what it does
serial information 1
parts 1
parts 2
serial information 2
parts 1
parts 2
and what it needs to do
serial information 1
parts 1
serial information 2
parts 1
the problem is instead of the part going with the correct serial. it basically puts the information for both parts i added under both of the 2 serials I am also having trouble deleting fields an adding fields for the parts fields.
if someone could explain what i am doing wrong with the parts i would really appreciate it. I know it has to do with the count, just not sure what i am doing wrong
here is the javascript for serial and parts that allows me to add serials and parts
here is the html/coldfusion that displays what was previously entered for serials and parts.
Thank you in advance,
Rach
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
My bad hcpn is hc_partNo. Its the same thing so its not missing just different naming. An for the parts about coldfusion are you meaning i need to add the pkpartid under the exec like so -
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Updateinsertparts
-
<cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
</cfquery>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
In your stored proc. you have: - @fk_serialNo nvarchar(100),
-
@fk_ticketNo nvarchar(100),
-
@hc_partNo nvarchar(50),
-
@part_returned char(10),
-
@rma_number nvarchar(1000),
-
@defective bit
so pass the fields in the same order. Are you sure you have hcpn there?
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Hcpn is in there, hcpn been working fine.the hcpn is where it type the part an i know its going under the right field, but like i said i can't figure out why it wont delete an also now its like duplicating the records. but do i need to add pk_partid in the following? - <cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Updateinsertparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
</cfquery>
an then do i need to add the pk_part id into the delete parts as well like so - <cfset partList = ArrayToList(partcheck, ",")>
-
<!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
-
<cfloop query="countparts">
-
<cfset pk_partID= #pk_partID#>
-
<!---if the part is not found in the list it begins deleteing--->
-
<cfif not listFind(partList,pk_partID)>
-
<cfquery name="deleteparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteparts
-
<cfqueryparam value="#pk_partID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
-
</cfquery>
-
</cfif>
-
</cfloop>
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
Now I see where part id is declared in your stored procedure.
Yes, in your delete, you would pass part ID as the first parameter.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
So would i pass the part as pkpartID or would i pass it as pk_partID? in my partsdisplay.cfm i have - <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
here is what i got for delete right now. but it don't delete if i change it from pkpartID to pk_partId it sorta works it will delete parts with different hcpn (sometimes) but not ones with the same name an then at some points it makes duplicate records that i did not insert -
<cfset partList = ArrayToList(partcheck, ",")>
-
<!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
-
<cfloop query="countparts">
-
<cfset pk_partID= #pk_partID#>
-
-
<!---if the part is not found in the list it begins deleteing--->
-
<cfif not listFind(partList,pk_partID)>
-
<cfquery name="deleteparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteparts
-
<cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
-
</cfquery>
-
</cfif>
-
</cfloop>
-
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
Add a cfdump for the partlist before the delete loop to see what the contents are.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I was not sure if i was suppose to deleteing as i did the cfdump. but here is where i put the cfdump - <cfdump var="#form#">
-
<!---THIS DELETES FOR THE PARTS TABLE--->
-
<!---setting a list for parts--->
-
<cfset partList = ArrayToList(partcheck, ",")>
-
<!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
-
<cfloop query="countparts">
-
<cfset pk_partID= #pk_partID#>
-
-
<!---if the part is not found in the list it begins deleteing--->
-
<cfif not listFind(partList,pk_partID)>
-
<cfquery name="deleteparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteparts
-
<cfqueryparam value="#pk_partID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
-
</cfquery>
-
</cfif>
-
</cfloop>
an here is what the cfdump says - ADDRESS
-
ATTACHMENT1
-
CITY
-
COMPANYNAME
-
COMPNAME
-
CONTACT Check box first!
-
COSTCENTERID
-
CUSTNOTES
-
CUSTNUM 96
-
CUSTOMER 96
-
DEFECTIVE 0
-
DEFECTIVE_2_1 0
-
DEPTVENDOR_1 Unknown at this time
-
DESCRIPTION1
-
EMAIL
-
ENTITY
-
FIELDNAMES PK_TICKETID,LAST_EDITED_BY,PKB_FK_TICKETNO,PKA_SERIALNO,FK_TICKETNO,FK_TICKETNO,FK_ADDEDBY,FK_ADDEDBY,TITLE,PRIORITY,STATUS,CUSTNUM,CUSTOMER,COMPNAME,FNAME,LNAME,ADDRESS,CITY,STATE,ZIP,EMAIL,PRIPHONE,SECPHONE,CUSTNOTES,COSTCENTERID,SUBMISSION,FOLLOWDATE,ONSITE,NUMONSITE,MODELNO_1,PRODUCTTYPE_1,HARDWAREFAILURE_1,SERIALNUM_1,SOFTHARDWARE_1,PK_NUM_1,THEDESCRIPTION_1,RESOLUTION_1,RESDATE_1,RESVERTIFIED_1,VERTIFIDATE_1,DEPTVENDOR_1,SERIALCOUNT,PKPARTID_1_1,HCPN_1_1,RMA_1_1,PARTSCOUNT1,PARTCOUNTER1,THEVALUE,ATTACHMENT1,DESCRIPTION1,UPLOADS,CONTACT,SUBMIT
-
FK_ADDEDBY
-
FK_TICKETNO 6,6
-
FNAME
-
FOLLOWDATE 01/01/1900
-
HARDWAREFAILURE_1 Infant Mortality
-
HCPN_1_1 test1
-
HCPN_2_1
-
HTPP 0
-
LAST_EDITED_BY
-
LNAME
-
MODELNO_1
-
NUMONSITE 0
-
ONSITE No
-
PARTCOUNTER1 2
-
PARTSCOUNT1 2
-
PARTSRETURN 0
-
PARTSRETURN_2_1 0
-
PK_NUM
-
PK_NUM_1
-
PK_TICKETID 6
-
PKA_SERIALNO test1
-
PKB_FK_TICKETNO 6
-
PKPARTID_1_1 106
-
PKPARTID_2_1
-
PRIORITY urgent
-
PRIPHONE
-
PRODUCTTYPE_1
-
RESDATE_1 01/01/1900
-
RESOLUTION_1
-
RESVERTIFIED_1
-
RMA_1_1
-
RMA_2_1
-
SCHOOLNAME
-
SECPHONE
-
SERIALCOUNT 1
-
SERIALNUM_1 test1
-
SOFTHARDWARE_1
-
STATE
-
STATENAME
-
STATUS Closed
-
SUBMISSION
-
SUBMIT submit
-
SUBMITTED_BY submittedby
-
THEDESCRIPTION
-
THEDESCRIPTION_1
-
THEVALUE 1
-
TITLE no serial
-
TOBOX
-
UPLOADS 1
-
VERTIFIDATE_1 01/01/1900
-
ZIP
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
I meant for partList or partcheck, but this should maybe help to see the values. Look for the part IDs. Are they what you expect?
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
ok i figured out partcheck. I did a test of inserting test 1 and test 2. When i inserted all that came up for partcheck was the below with no partID (like it should)
1
2
3
however, it should not have 3 parts i inserted, because i only inserted 2 (althought i don't see a 3rd in one the table).
but when i looked below i had parts 0, parts 1, parts 2 (althought i inserted 2 parts only). When i went to look back at the results i had test 1, test 2. I deleted test 1 which is pk number 122 (test 2 is 123). When i clicked submit the part check says 1. 123, an when you look below it says part 2 (like it should).
When i look back at the results again after deleteing test 1 i see test 2 appear twice. the first holding 123 (like it should) the second holding 124.Its like its deleteing like it should but updating like its not suppose to.
Here is what i got in full on userformedit.cfm -
<CFIF REQUEST_METHOD EQ "POST">
-
-
<!---counts how many serials are there--->
-
<cfquery name="countserials" datasource="CustomerSupport">
-
SELECT pka_serialNo from dbo.tbl_CS_serial where pkb_fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<cfset currSerialNo = 1>
-
-
<!--- the array gets serials that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
-
<cfset serialcheck = ArrayNew(1)>
-
<!--- first loop inserts/update serials--->
-
<CFLOOP list="#form.serialcount#" index="machineCount">
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET serialnum = Form["serialnum_" & machineCount]>
-
<CFSET modelno = Form["modelno_" & machineCount]>
-
<CFSET producttype = Form["producttype_" & machineCount]>
-
<CFSET softhardware = Form["softhardware_" & machineCount]>
-
<CFSET resolution = Form["resolution_" & machineCount]>
-
<CFSET resdate = Form["resdate_" & machineCount]>
-
<CFSET resvertified = Form["resvertified_" & machineCount]>
-
<CFSET vertifidate = Form["vertifidate_" & machineCount]>
-
<CFSET deptvendor = Form["deptvendor_" & machinecount]>
-
<CFSET hardwarefailure = Form["hardwarefailure_" & machineCount]>
-
<CFSET thedescription = Form["thedescription_" & machineCount]>
-
<!---the array checks to see what serials are there--->
-
<CFSET ArrayAppend(serialcheck, "#Form["serialnum_" & machineCount]#")>
-
-
-
<!--- counts how many parts are available--->
-
<cfquery name="countparts" datasource="CustomerSupport">
-
SELECT pk_partID from dbo.tbl_CS_parts where fk_serialNo=<cfqueryparam value="#serialnum#"> and fk_ticketNo=<cfqueryparam value="#Form.pk_ticketID#">
-
</cfquery>
-
<!--- the array gets parts that have been inserted and updated to avoid deleteing the ones that need to be inserted or updated--->
-
<cfset partcheck = ArrayNew(1)>
-
-
-
<!--- inserts information into the serial table--->
-
<cfquery name="serialinsertupdate" datasource="CustomerSupport">
-
exec usp_CS_Updateinsertserial
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
"#Form.pk_ticketID#",
-
<cfqueryparam value="#modelno#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#producttype#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#softhardware#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resolution#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#resdate#">,
-
<cfqueryparam value="#resvertified#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#vertifidate#">,
-
<cfqueryparam value="#deptvendor#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#hardwarefailure#" CFSQLType = "CF_SQL_VARCHAR">
-
</cfquery>
-
-
<!---Inserts information into notes_descr table.--->
-
-
<!--- the pk_num makes each description added unique, this allows us to delete one descriptoin instead of all description associated with a serial--->
-
<cfif thedescription neq "">
-
<cfquery name="description" datasource="CustomerSupport">
-
exec usp_CS_Insertdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#',
-
<cfqueryparam value="#thedescription#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.fk_addedBy#'
-
</cfquery>
-
<cfelse>
-
</cfif>
-
-
-
<!---Inserts information into parts table.--->
-
<!---because it is a bit we don't use 'ticks' around defective for parts table--->
-
<cfparam name="form.partscount#machinecount#" default="">
-
<cfloop list="#form['partscount' & machinecount]#" index="ps">
-
<!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
-
<cfparam name="Form.pkpartID_#ps#_#machinecount#" default="">
-
<cfparam name="Form.hcpn_#ps#_#machinecount#" default="">
-
<cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
-
<cfparam name="Form.defective_#ps#_#machinecount#" default="0">
-
<cfparam name="Form.rma_#ps#_#machinecount#" default="">
-
<!--- the pkpartID makes each part added unique, this allows us to delete one part instead of all parts associated with a serial--->
-
-
<CFSET pkpartID = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
-
<CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]>
-
<CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]>
-
<!---the array checks to see what parts are there--->
-
<CFSET ArrayAppend(partcheck, "#Form["pkpartID_" & "#ps#" & "_#machinecount#"]#")>
-
<!---if hcpn is not equal to blank (meaning if it doesn't have a value) it will not insert a part. However if hcpn
-
has a value it will insert the part into the table.--->
-
<cfif hcpn neq "">
-
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Updateinsertparts
-
<!--- --->
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
</cfquery>
-
<cfelse>
-
</cfif>
-
</cfloop>
-
-
<!---THIS DELETES FOR THE PARTS TABLE--->
-
<!---setting a list for parts--->
-
<cfset partList = ArrayToList(partcheck, ",")>
-
<cfdump var="#partList#">
-
<!---when inserting/updating for part's table is done it then delete parts not being updated/inserted or was to be deleted on purpose--->
-
<cfloop query="countparts">
-
<cfset pk_partID= #pk_partID#>
-
-
<!---if the part is not found in the list it begins deleteing--->
-
<cfif not listFind(partList,pk_partID)>
-
<cfquery name="deleteparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteparts
-
<cfqueryparam value="#pk_partID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfif>
-
</cfloop>
-
-
-
-
</CFLOOP>
-
-
<!---THIS DELETES FOR SERIAL TABLE AND ANY PARTS ASSOCIATED WITH THE SERIAL--->
-
<!---setting a list for serial--->
-
<cfset serialList = ArrayToList(serialcheck, ",")>
-
<!---when inserting/updating for serial's table is done it then delete serials not being updated/inserted or was to be deleted on purpose--->
-
<cfloop query="countserials">
-
<CFSET serialnum = #pka_serialNo#>
-
<!---if the serial is not found in the list it begins deleteing--->
-
<cfif not listFind(serialList,serialnum)>
-
<cfquery name="deleteserialparts" datasource="CustomerSupport">
-
exec usp_CS_Deleteserialparts
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
<!--- if a serial is deleted, then the description for that serial will be deleted as well.--->
-
<cfquery name="deletedescription" datasource="CustomerSupport">
-
exec usp_CS_Deletenotesdescription
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#'
-
</cfquery>
-
</cfif>
-
</cfloop>
-
-
</CFIF>
Thank you,
Rach
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
To update from post 459. I ended up moving this from serialpartsdisplay.cfm to underneath the ending div on partsdisplay.cfm -
<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
-
this seemed to make the parts 0 stop appearing each time.
an then in my stored procedure i changed it to the following an got rid of declare -
(@pk_partID nvarchar(55),
-
@fk_serialNo nvarchar(100),
-
@fk_ticketNo nvarchar(100),
-
@hc_partNo nvarchar(50),
-
@part_returned char(10),
-
@rma_number nvarchar(1000),
-
@defective bit
-
)
-
an in my cfquery i added -
<cfquery name="parts" datasource="CustomerSupport">
-
exec usp_CS_Updateinsertparts
-
<!--- --->
-
<cfqueryparam value="#pkpartID#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
-
'#Form.pk_ticketID#',
-
<cfqueryparam value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">,
-
<cfqueryparam value="#defective#" CFSQLType = "CF_SQL_BIT">
-
</cfquery>
-
This seemed to stop the duplicated (adding records that i didn't want added) an it let me delete any record i choose.
the remaining problem still is on printticketedit.cfm when i delete a part it shows an empty part for it when it shouldnt.this is what i am doing for parts on printticketedit.cfm -
<cfloop list="#form['partscount' & machinecount]#" index="ps">
-
<CFSET pkpartID = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
-
<CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]>
-
<CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]>
-
<fieldset>
-
<legend>Parts information #ps# Serial information #machinecount#</legend>
-
<ol>
-
<li> <label for="HC P/N">HC P/N::</label>
-
#hcpn#<br/>
-
</li>
-
<li>
-
<label for="have all parts been returned">Parts been returned:</label>
-
<cfswitch expression="#evaluate(partsreturn)#
-
">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch>
-
<br/>
-
</li>
-
<li>
-
<label for="defective">Defective:</label>
-
<cfswitch expression="#evaluate(defective)#">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch><br/>
-
</li>
-
<li>
-
<label for="rma data only">RMA Data Only:</label>
-
#rma#<br/>
-
</li>
-
</ol>
-
</fieldset>
-
</CFLOOP>
-
Thank you,
Rach
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
First off i am sorry about all 3 posts, but i think i got it figured out! I realized that when i delete the hcpn number disappears so i used the following for printticketedit.cfm an it worked. - <cfloop list="#form['partscount' & machinecount]#" index="ps">
-
<CFSET pkpartID = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
-
<CFSET hcpn = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET partsreturn = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
-
<CFSET defective = Form["defective_" & "#ps#" & "_#machinecount#"]>
-
<CFSET rma = Form["rma_" & "#ps#" & "_#machineCount#"]>
-
<cfif hcpn neq "">
-
<fieldset>
-
<legend>Parts information #ps# Serial information #machinecount#</legend>
-
<ol>
-
<li> <label for="HC P/N">HC P/N::</label>
-
#hcpn#<br/>
-
</li>
-
<li>
-
<label for="have all parts been returned">Parts been returned:</label>
-
<cfswitch expression="#evaluate(partsreturn)#">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch>
-
<br/>
-
</li>
-
<li>
-
<label for="defective">Defective:</label>
-
<cfswitch expression="#evaluate(defective)#">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch><br/>
-
</li>
-
<li>
-
<label for="rma data only">RMA Data Only:</label>
-
#rma#<br/>
-
</li>
-
</ol>
-
</fieldset>
-
<cfelse>
-
</cfif>
-
</CFLOOP>
but let me know after you read all 3 posts (which again sorry for so many) if what i have done will be ok/work. It looks like it works good an i have done lots of tests but i just wanna make sure it will be ok before i leave it at where i have it.
Thank you :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
That looks good. I now see how the duplicates might have appeared. As for the hcpn, I'm not sure exactly how that solves the problem, but you know the inner workings of the system better than me.
Good work, and I actually prefer when you use another post to describe something because you can see the trail of effort and thought rather than an edit.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Well the reason i am using the hcpn is because what happens is when i delete a part. Instead of not showing the part when i delete it still shows the part i deleted just empty, like hcpn an all the fields are just empty. So if i check if the hcpn is empty then if it is empty it wont show up. But if you have another solution or a better way i could go about that let me know. I don't know why it shows when i delete a part, before the new changes if i deleted a part it wouldn't appear. But i am doing it as i did in the last post.
An i am relieved that i didn't annoy you with all the posts. i was thinking he is going to be going oh no look at all these posts! so i am relieved lol. But thank you so much for all the help you have no idea how much i appreciate it all :)
Thank you again :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
That does seem like a fix because if it's deleted, it shouldn't show up. Where and when is this print page called?
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
After all the information is submitted. It appears at the end of userformedit.cfm as a template. so would this be an ok solution or could there be another way? like i said it didn't start doing this till after i made the changes.
i have also noticed another problem. My checkboxs are not working. If i click yes it will not change to yes it remains no an its only for the parts section. Here is how i am displaying it on partsdisplay.cfm -
<input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"
-
<cfif #part_returned# eq "1">checked=yes</cfif>/>
-
-
<input type="checkbox" name="defective_#count1#_#count#"
-
value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/>
-
i have done all the other fields in my form this way, any ideas?
Thank you,
Rach
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I havent gotten any further on the checkboxes. The only thing i know is when i insert for the first time a part if i have it as checked or yes i have no problem changing the checkbox from yes to no back to yes. But if i submit it as no i can not get it to go back to yes. i also have figured this out with another field, in one section if i go back to cticketpage1edit.cfm if i submitted htpp as no to begin with if i try to change it to yes an submit it it wont do it, it wont even submit.but i am doing them all the same which is like so - <input type="checkbox" name="defective_#count1#_#count#"
-
value="#defective#"<cfif #defective# eq "1">checked=yes</cfif> /
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
Check the database. Is it deleted from the database?
Re. checkboxes: Try something like: - <input type="checkbox" name="partsreturn_#count1#_#count#" value="1"
-
<cfif Val(part_returned) eq 1>checked</cfif>/>
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Yes parts is being delete from the table. An that worked perfectly for the checkbox.
I don't know if this would help but this is what my print ticket looks like
Thank you :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
If it's after submission, you don't need to use the form fields. You can use the database to show the current data.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I am confused by what you mean. Even if i take the form fields out like below i am still getting the same results - <cfloop list="#form['partscount' & machinecount]#" index="ps">
-
<fieldset>
-
<legend>Parts information #ps# Serial information #machinecount#</legend>
-
<ol>
-
<li> <label for="HC P/N">HC P/N:</label>
-
#hcpn#<br/>
-
</li>
-
<li>
-
-
<label for="have all parts been returned">Parts been returned:</label>
-
<cfswitch expression="#evaluate(partsreturn)#">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch>
-
<br/>
-
</li>
-
<li>
-
<label for="defective">Defective:</label>
-
<cfswitch expression="#evaluate(defective)#">
-
<cfcase value="0" delimiters=",">
-
No
-
</cfcase>
-
<cfcase value="1" delimiters=",">
-
Yes
-
</cfcase>
-
</cfswitch><br/>
-
</li>
-
<li>
-
<label for="rma data only">RMA Data Only:</label>
-
#rma#<br/>
-
</li>
-
</ol>
-
</fieldset>
-
</CFLOOP>
-
</cfloop>
-
</cfoutput>
i also tried to just cfloop query="parts" around the whole section an that seemed to cause the same effect.
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
By that, I meant a new query and loop over the results.
You may be able to work with the form fields too, but it'd require adding all of that code that you used earlier for adding/updating/deleting to display the correct current information.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I think i know what the problem is an i could cry. I forgot in my serialpartsdisplay.cfm i did this. -
<cfset count1 = 0>
-
<cfloop query="getparts">
-
<cfset count1 = count1 + 1>
-
<cfset hc_partNo = #hc_partNo#>
-
<cfset part_returned = #part_returned#>
-
<cfset defective = #defective#>
-
<cfset rma_number = #rma_number#>
-
<cfinclude template="partsdisplay.cfm">
-
</cfloop>
-
-
<cfif serial.recordcount is 0 and getparts.recordcount is 0>
-
<cfset count1 = 1>
-
<cfset hc_partNo = "">
-
<cfset part_returned = "">
-
<cfset defective = "">
-
<cfset rma_number = "">
-
<cfinclude template="partstest.cfm">
-
</cfif>
-
basically partstest.cfm is a copy of partsdisplay.cfm without the hidden line for pkpartID. An well i tried to change it back to partsdisplay.cfm but now it wont work (again). It will work if have parts, but if don't have parts i get an error an its an administrator error. If i comment out pkpartID the part will appear when no serial are filled out, however if pkpartID is not commented out it gives an error.Is there anyway to have pk_partID in partsdisplay.cfm an not in partsdisplay.cfm at the same time? here is what i got on partsdisplay.cfm. here is what i got on
partsdisplay.cfm -
<cfoutput>
-
<div id="part#count1#Name#count#">
-
-
-
<input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
-
-
<!---<cfset partliststr = "">
-
<cfloop from="1" to="#count1#" index="pl">
-
<cfset partliststr = partliststr & #pl# & ",">
-
</cfloop>
-
-
<input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
-
<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
-
-
<!---THIS IS THE PARTS SECTION--->
-
-
-
-
<table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
-
<th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
-
<tr>
-
<td class='indent' id='formfieldpadding'>HC P/N: <input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
-
<td>
-
Parts been returned
-
<input type="checkbox" name="partsreturn_#count1#_#count#" value="1"<cfif Val(part_returned) eq 1>checked</cfif>/>
-
</td>
-
<td>
-
<td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#"
-
value="1"<cfif Val(defective) eq 1>checked</cfif> /></td>
-
</td>
-
</tr>
-
</table>
-
<!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
-
-
-
<!--- Shows what was previously entered for RMA Data Only --->
-
<table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
-
<tr>
-
<td id="paddingformultitop">
-
RMA Data Only:
-
</td>
-
<td class="rmanmoveinmulti">
-
( You may enter up to 1000 characters. )
-
<br/>
-
-
<textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea></td>
-
</tr>
-
</table>
-
-
-
<!--- Adds Delete to every ticket --->
-
<table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
-
<tr>
-
<td>
-
-
<input type="button" class="removeticket" value="Remove Parts #count1#"
-
onclick="removetheElement('part#count1#Name#count#',#count#,#count#)">
-
</td>
-
</td>
-
</tr>
-
</table>
-
-
-
</div>
-
<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
-
</cfoutput>
-
-
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
You need to add
but I have a question. If a part is empty, it won't have a part ID, so how is that dealt with. I could look back at your previous posts/code, but trying to sieve through all that code would be a bit of a mission!
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
That worked perfectly!!! but i am going to do some more tests after lunch an DOUBLE check to make sure.An i don't blame you one bit for not wanting to look back at the post lol
But ok here is how it is working. If a part ID exists, it will update. However, if a part ID does not exist it will insert a new record. So basically if you took firebug an looked at it (at a previous part) you would see with each part it has a part id associated, but if you add a part no part id associated. However, if you submitted that part with no part id, if you went back an looked at cticketpage2edit.cfm an used firebug you would see it got assigned a part id after submission.
but thank you so much for the help, all come back after i do more tests an let you know if this thread can finally be put to rest. But thank you again for all the help!!!
Thank you :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
Well, a small fix in the end as it is the case with a lot of problems. Hopefully that's the last of them :)
It does make sense how you're using the part ID.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I do got one last problem. For some reason i can insert attachments fine. But when i go to cticketpage2edit.cfm an try to add more attachments it wont let me download them on to the table. So i was wondering could what we did to serials and parts mess with it?
Thank you
Rach
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
I figured out attachments, i needed to change one word in it. But i also realized that to download a file you need a serial, is there anyway to put like a blank entry in the serial section of attachments so that they could still upload attachments? here is what i am using for attachments now -
<!---Inserts attachments into attachments.--->
-
<cfif structKeyExists(FORM, "uploads")>
-
<cfset currentDirectory = GetDirectoryFromPath(GetTemplatePath()) & "uploaded">
-
<cfparam name="FORM.uploads" default="">
-
<cfloop list="#form.uploads#" index="counter">
-
<cfset currentDescription = form["description" & counter]>
-
<!--- verify the form field exists --->
-
<cfif structKeyExists(FORM, "attachment"& counter)>
-
<!--- try and upload it ...--->
-
<cftry>
-
<cfif Len(FORM["attachment#counter#"])>
-
<cffile action="upload" fileField="form.attachment#counter#" destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\" nameconflict="MAKEUNIQUE">
-
<cfset filename = cffile.ClientFileName & "_" & form.pk_ticketID & "_" & counter & "." & cffile.ClientFileExt>
-
<!--- IF RUN INTO PROBLEMS WITH FILES NOT GOING INTO TABLE MAKE SURE EVERYTHING BETWEEN SOURCE="" IS ALL ON ONE LINE--->
-
<CFFILE ACTION="RENAME" SOURCE="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#CFFILE.ServerFile#"
-
destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#filename#">
-
<cfquery name="attachment" datasource="CustomerSupport">
-
exec usp_CS_UpdateInsertattachments
-
'#Form.pk_ticketID#','#serialnum#','#currentDescription#','#filename#','#Form.fk_addedBy#'
-
</cfquery>
-
</cfif>
-
<cfcatch><!--- do something here, e.g. display error message.. --->
-
</cfcatch>
-
</cftry>
-
</cfif>
-
</cfloop>
-
</cfif>
but besides that serials and parts are working perfectly :).
Thank you again for all the help :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
I'm not sure I quite understand what you mean here: Quote:
Originally Posted by bonneylake But i also realized that to download a file you need a serial, is there anyway to put like a blank entry in the serial section of attachments so that they could still upload attachments? So you want users to be able to upload attachments without depending on serials?
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Yes that is correct. Right now they can submit contact information without a serial or part. But if you try to upload an attachment it wont let you put it in the database without a serialnum.
Thank you,
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
The problem is that attachments are linked/attached to a serial. Change the database to only link attachments to the ticket by removing serial number and then change your Coldfusion code accordingly.
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Well i thought about it over the weekend an i realize theres no point to allowing users to upload attachments if there is no serials. I thought it would be cool to do it in case the situation came up. But the point of attachments is that if they have serials its suppose to go with all the serials for that ticket. So i think i am going to leave it for now unless they decide later they need to upload attachments without a serial. But i wanted to say thank you again for all the help you have given me. you have no idea how much i appreciated it!!!
Thank you again :),
Rach
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: displaying previously entered multiple fields
You're welcome. It's no problem at all.
PS. we didn't quite make it to 500 ;D
| | Site Addict | | Join Date: Aug 2008 Location: United States
Posts: 769
| | | re: displaying previously entered multiple fields
Hey Acoder,
Yes i am glade we didn't make it to 500 either lol. Its long enough an hard to go through as is (tried to the other day). But again Thank You for all the help :)
Thank you again :),
Rach
|  | | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,223 network members.
|