displaying previously entered multiple fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bonneylake
    Contributor
    • Aug 2008
    • 769

    Originally posted by acoder
    Is the previous problem solved? I still notice that the parts input fields are not quite in the right place. They should be outside the getparts loop, but inside the serial cfoutput loop.

    When you see duplicates, is the count the same for the second serial?
    Hey Acoder,

    Yes the inserting is working correctly. But the thing is if its outside the getparts loop then it wont be able to get the value for count1 right? because it uses the following to get the count.

    Code:
    <cfset count1 = 0>
    <!---<cfif serial.recordcount is 0>--->
    <cfloop query="getparts">
    <cfset count1 = count1 + 1>
    An with the serial its counting correctly. When it does duplicates it is counting correctly. If i had a previously submitted one that was serial information 1, when it duplicates it you see serial information 1 and then it makes serial information 2 below it.an all the fields an everything says serial information 2.

    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      Sorry, the partscount field is in the right place. It's the partcounter field that needs to be moved about 2/3 lines lower because you only need one per serial.

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        Originally posted by acoder
        Sorry, the partscount field is in the right place. It's the partcounter field that needs to be moved about 2/3 lines lower because you only need one per serial.
        Hey Acoder,

        Ok so would this be correct?

        Code:
        <!--- 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#)"></a>
        </td>
        </td>
        </tr>
        </table>
        </div>
        <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">
        
        </cfloop>
        </div> 
        <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
        </cfoutput>
        <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
        Thank you,
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          That looks about right.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            Originally posted by acoder
            That looks about right.
            Hey Acoder,

            I tried it but i am still getting duplicates. I think i know what the problem is. I first took out everything extra that i didn't need to make the multiple fields work, that was not the problem. I then took out everything involving parts including javascript and html. That was not causing the problem. I finally took out everything javascript related an that was not causing the problem. The problem is with the serial section in the html. I think the count is adding extra to it. i tried renaming count from count to thecount an that didn't seem to make a difference at all an still is inserting duplicate. But it says its the html for the serial section is whats causing it cause i took everything else out except the display for serial section an it still duplicated.


            and here is the html for serial
            Code:
            <!--- Ticket Information 
                   This display the ticket Information--->
                
            <!---<input type="hidden" value="0" id="theValue" />--->
                <div id="dynamicInput"> 
                 <!--- All Ticket Information Appears Here--->
             
            <cfset count = 0>
            <!---<cfif serial.recordcount is 0>--->
            <cfoutput query="serial">
            <cfset model_no = #model_no#>
            <cfset product_type = #product_type#>
            <cfset type_hardware_failure = #type_hardware_failure#>
            <cfset software_hardware = #software_hardware#>
            <cfset resolution_verified_by = #resolution_verified_by#>
            <cfset dept_responsibility = #dept_responsibility#>
            <cfset count = count + 1>
             <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
            <div id="dynamic#count#Input"> 
            <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_#count#">
            <option value="">Make A Selection</option>
            <cfloop query="models">
            <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
            </cfloop> 
            </select>
            </td>
            <td>
            &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
            </td>
            <td>
            <select name="producttype_#count#">
            <option value="" selected>No Choice</option>
            <cfloop query="getProdType">
            <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
            </cfloop>
            </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_#count#">
            <option value="" selected>Make A Selection</option>
            <cfloop query="getHardwareFail">
            <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
            </cfloop>
            </select>
            </td>
            </tr>
            <table>
             
            <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
            <table class="zpExpandedTable" id="modeltable">
            <tr>
            <td id="paddingformultitop">
            Serial Number:&nbsp;&nbsp;
            <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
            &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
            <select name="softhardware_#count#">
            <option value="" selected>No Choice</option>
            <cfloop query="getSoftHard">
            <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
            </cfloop>
            </select>
            </td>
            </tr>
            </table>
            
            <!--- Shows what was previously entered for Description ---> 
            
            <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
            <tr>
            <td id="paddingformutli">
            Description:&nbsp;&nbsp;
            </td>
            <td class="descriptionmoveinmulti">
            #description#
            ( You may enter up to 1000 characters. )
            <br>
            <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
            </td>
            </tr>
            </table>
             
            <!---Shows what was previously entered for Resolution  --->
            
            <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 1500 characters. )
            <br>
            <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
            </td>
            </tr>
            </table>
             
            <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
            
            <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
            <tr>
            <td id="paddingformultitop">
            Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
            </td>
            <td>
            <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
            <input type="checkbox" name="currentdateresol_#count#" 
            onClick="resdate_#count#.value=fill_date()">
            </td>
            <td>
            Resolution Verified as effective by:&nbsp;&nbsp;
            </td>
            <td>
            <select name="resvertified_#count#">
            <option value="" selected>Make A Selection</option>
            <cfloop query="gettech">
            <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
            selected</cfif>>#fname# #lname#</option>
            </cfloop>
            </select>
            </td>
            </tr>
            </table>
            <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
            <tr>
            <td id="paddingformultitop">
            Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
            </td>
            <td class="vertificationmoveinmulti">
            <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
            &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
            <input type="checkbox" name="currentdatevert_#count#" 
            onClick="vertifidate_#count#.value=fill_date()">
            </td>
            </tr>
            </table>
             
            <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
            <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_#count#">
            <option value="" selected>Make A Selection</option>
            <cfloop query="getDeptVendor">
            <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
            </cfloop>
            </select>
            </td>
            </tr>
            </table>
            
            
            <input type="hidden" name="serialcount" id="serialcount" value="#count#">
            <!--- Adds Delete to every ticket  --->
            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
            <tr>
            <td>
            <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
            </td>
            </tr>
            <tr>
            <td>
            <input type="button" class="addticket" value="Add Parts" onclick="addpartInput('dynamic#count#Input')">
            </td>
            </tr>
            </table>
            </div>
            </cfoutput>
            <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
            </div>
                 <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
            Thank you,
            Rach

            Comment

            • bonneylake
              Contributor
              • Aug 2008
              • 769

              Hey Acoder,

              I have definately determined that these lines in the html are causeing it

              Code:
              <cfset count = 0>
              <!---<cfif serial.recordcount is 0>--->
              <cfoutput query="serial">
              <cfset count = count + 1>
              well this is my guess on how its doing it. Basically when you first go to the edit page for the first time your serial has a default of 0. However, since we have count + 1 it then makes it serial information 1. When i submit it an go back to look at it. All the information is serial information 1 an so basically it goes and adds another one since we have count +1 which makes the duplicate. Sorry if thats confusing but its kinda hard to explain. But i been messing with the count for a while an thats how it came to me. But i have no clue what i could change the count to to make it work right. any suggestions?

              Thank you,
              Rach

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                I won't have time to look at this until probably Monday at the earliest, but well done on what you've managed so far. I suspected the problem would be in the HTML display code. Hopefully, you'll have found something by then. If not, Monday it is.

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  Originally posted by bonneylake
                  I have definately determined that these lines in the html are causeing it

                  Code:
                  <cfset count = 0>
                  <!---<cfif serial.recordcount is 0>--->
                  <cfoutput query="serial">
                  <cfset count = count + 1>
                  well this is my guess on how its doing it. Basically when you first go to the edit page for the first time your serial has a default of 0. However, since we have count + 1 it then makes it serial information 1. When i submit it an go back to look at it. All the information is serial information 1 an so basically it goes and adds another one since we have count +1 which makes the duplicate.
                  I doubt that would be the case because of the first line which sets count to 0, so whenever you visit the page, the count is initially 0.

                  When you revisit the page and see the duplicates, can you show an example of the generated HTML (as seen in the browser)?

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    Originally posted by acoder
                    I doubt that would be the case because of the first line which sets count to 0, so whenever you visit the page, the count is initially 0.

                    When you revisit the page and see the duplicates, can you show an example of the generated HTML (as seen in the browser)?
                    Hey Acoder,

                    Alrighty here are some pictures. The first picture shows the original previously submitted serial and half of the duplicate. An the second picture shows the duplicate

                    first picture
                    Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.


                    second picture
                    Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.


                    an also forgot to mention. For some reason when i go back an look it doesn't show the part i added. I originally had 1 serial and 1 part. Its been doing this recently where it will show if i go to previously look at it the one serial and one part. But when i resubmit it an go back an look it only shows the serial.

                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      I did mean the actual HTML code rather than a picture, but that will do.

                      As far as I can see, the Coldfusion code looks OK. What I suggest you try is to test the serial query in the SQL Server Query Analyzer. Does it produce the same output, i.e. two duplicate records for the same ticket?

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        Originally posted by acoder
                        I did mean the actual HTML code rather than a picture, but that will do.

                        As far as I can see, the Coldfusion code looks OK. What I suggest you try is to test the serial query in the SQL Server Query Analyzer. Does it produce the same output, i.e. two duplicate records for the same ticket?
                        Hey Acoder,

                        I am not sure how i would test the query using the sql server query analyzer. But i know for a fact that it has not inserting duplicate records.I have checked multiple times the table an i only see one record. Also, each ticket has to have a unique serial number meaning if i have serial 1 and serial 2 it will insert fine. However, if i try to insert serial 1 and serial 1 it will not insert and will give me an error due to you can not insert the same serial name twice with the same ticket. It don't matter if any of the other information is different, as long as the serial names are the same an error will occur. Right now if i tried to insert the duplicate you seen it would give me an error an would not insert. However, if i delete the duplicate and just insert serial 1 it will insert with no problems. However if i went back an looked instead of having serial 1 and the duplicate you would then have a second duplicate of serial 1. so it be serial 1 (original) serial 1(first duplicate) serial 1 (second duplicate).

                        an i just noticed something i was playing around with the example i gave you. An well i looked at what the value was before i deleted (the duplicate) and i looked at what the value was after i deleted (the duplicate) an it still said 2 even after i deleted when it should say one. Is it possible that the value could be causing it? here is the line for the value

                        Code:
                        <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
                        But here is a copy of the html i have right now

                        Code:
                        <!--- Ticket Information 
                               This display the ticket Information--->
                            
                        <!---<input type="hidden" value="0" id="theValue" />--->
                            <div id="dynamicInput"> 
                             <!--- All Ticket Information Appears Here--->
                         
                        
                        
                        
                        <!---<cfif serial.recordcount is 0>--->
                        <cfset count = 0>
                        
                        <cfoutput query="serial">
                        
                        <cfset count = count + 1>
                        <cfset model_no = #model_no#>
                        <cfset product_type = #product_type#>
                        <cfset type_hardware_failure = #type_hardware_failure#>
                        <cfset software_hardware = #software_hardware#>
                        <cfset resolution_verified_by = #resolution_verified_by#>
                        <cfset dept_responsibility = #dept_responsibility#>
                        
                         <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
                        
                        <div id="dynamic#count#Input"> 
                        <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_#count#">
                        <option value="">Make A Selection</option>
                        <cfloop query="models">
                        <option value="#model#"<cfif #model# is #model_no#>selected</cfif>>#model#</option>
                        </cfloop> 
                        </select>
                        </td>
                        <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;Product Type:
                        </td>
                        <td>
                        <select name="producttype_#count#">
                        <option value="" selected>No Choice</option>
                        <cfloop query="getProdType">
                        <option value="#pk_productType#"<cfif #pk_productType# is #product_type#>selected</cfif>>#pk_productType#</option> 
                        </cfloop>
                        </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_#count#">
                        <option value="" selected>Make A Selection</option>
                        <cfloop query="getHardwareFail">
                        <option value="#pk_hardwareFailure#"<cfif #pk_hardwareFailure# is #type_hardware_failure#>selected</cfif>>#pk_hardwareFailure#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        <table>
                         
                        <!--- Shows what was previously entered for Serial Number and Software/Hardware  --->
                        <table class="zpExpandedTable" id="modeltable">
                        <tr>
                        <td id="paddingformultitop">
                        Serial Number:&nbsp;&nbsp;
                        <input type="text" name="serialnum_#count#" value="#pka_serialNo#">
                        &nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;
                        <select name="softhardware_#count#">
                        <option value="" selected>No Choice</option>
                        <cfloop query="getSoftHard">
                        <option value="#pk_softwareHardware#"<cfif #pk_softwareHardware# is #software_hardware#>selected</cfif>>#pk_softwareHardware#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        </table>
                        
                        <!--- Shows what was previously entered for Description ---> 
                        
                        <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
                        <tr>
                        <td id="paddingformutli">
                        Description:&nbsp;&nbsp;
                        </td>
                        <td class="descriptionmoveinmulti">
                        #description#
                        ( You may enter up to 1000 characters. )
                        <br>
                        <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
                        </td>
                        </tr>
                        </table>
                         
                        <!---Shows what was previously entered for Resolution  --->
                        
                        <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 1500 characters. )
                        <br>
                        <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
                        </td>
                        </tr>
                        </table>
                         
                        <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
                        
                        <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformultitop">
                        Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                        </td>
                        <td>
                        <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                        <input type="checkbox" name="currentdateresol_#count#" 
                        onClick="resdate_#count#.value=fill_date()">
                        </td>
                        <td>
                        Resolution Verified as effective by:&nbsp;&nbsp;
                        </td>
                        <td>
                        <select name="resvertified_#count#">
                        <option value="" selected>Make A Selection</option>
                        <cfloop query="gettech">
                        <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
                        selected</cfif>>#fname# #lname#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        </table>
                        <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformultitop">
                        Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                        </td>
                        <td class="vertificationmoveinmulti">
                        <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                        <input type="checkbox" name="currentdatevert_#count#" 
                        onClick="vertifidate_#count#.value=fill_date()">
                        </td>
                        </tr>
                        </table>
                         
                        <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
                        <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_#count#">
                        <option value="" selected>Make A Selection</option>
                        <cfloop query="getDeptVendor">
                        <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        </table>
                        
                        
                        <input type="hidden" name="serialcount" id="serialcount" value="#count#">
                        <!--- Adds Delete to every ticket  --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td>
                        <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
                        </td>
                        </tr>
                        <tr>
                        <td>
                        <input type="button" class="addticket" value="Add Parts" onclick="addpartInput('dynamic#count#Input')">
                        </td>
                        </tr>
                        </table>
                        
                        
                        <!---Shows what was previously entered into parts table--->
                        <!---dbtype="query"--->
                        <cfquery name="getparts" dbtype="query" >
                        SELECT *
                        FROM parts
                        WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
                        cfsqltype="cf_sql_char" maxLength="20">
                        </cfquery>
                        <cfset count1 = 0>
                        <!---<cfif serial.recordcount is 0>--->
                        <cfloop query="getparts">
                        <cfset count1 = count1 + 1>
                        <div id="part#count1#Name#count#">
                        <!---<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:&nbsp;&nbsp;&nbsp;<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="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
                        </td>
                        <td>
                        <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</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:&nbsp;&nbsp;&nbsp;&nbsp;
                        </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#)"></a>
                        </td>
                        </td>
                        </tr>
                        </table>
                        </div>
                        
                        <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
                        </cfloop>
                        
                        </div>
                        <!---this one makes it so you can add a part to a previously submitted serial--->
                        <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
                        </cfoutput>
                        
                        <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
                        
                        
                        
                        <!---If have any blanks in serial table it will make field appear--->
                        <!---<cfoutput query="serial">
                        <cfset model_no = #model_no#>
                        <cfset product_type = #product_type#>
                        <cfset type_hardware_failure = #type_hardware_failure#>
                        <cfset pka_serialNo = #pka_serialNo#>
                        <cfset software_hardware = #software_hardware#>
                        <cfset description = #description#>
                        <cfset resolution = #resolution#>
                        <cfset resolution_date = #resolution_date#>
                        <cfset resolution_verified_by = #resolution_verified_by#>
                        <cfset verification_date = #verification_date#>
                        <cfset dept_responsibility = #dept_responsibility#>
                        </cfoutput>
                        <cfif serial.recordcount is 0>
                        <cfset model_no = "">
                        <cfset product_type = "">
                        <cfset type_hardware_failure = "">
                        <cfset pka_serialNo = "">
                        <cfset software_hardware = "">
                        <cfset description = "">
                        <cfset resolution = "">
                        <cfset resolution_date = "">
                        <cfset resolution_verified_by = "">
                        <cfset verification_date = "">
                        <cfset dept_responsibility = "">
                        <cfinclude template="serialdisplay.cfm">
                        </cfif>--->
                        
                        <!---Parts Information, display parts if have or don't have a value--->
                        <!---<cfoutput query="parts">
                        <cfset hc_partNo = #hc_partNo#>
                        <cfset part_returned = #part_returned#>
                        <cfset defective = #defective#>
                        <cfset rma_number = #rma_number#>
                        <cfinclude template="partsdisplay.cfm">
                        </cfoutput>
                        <cfif parts.recordcount is 0>
                        <cfset hc_partNo = "">
                        <cfset part_returned = "">
                        <cfset defective = "">
                        <cfset rma_number = "">
                        <cfinclude template="partsdisplay.cfm">
                        </cfif>--->
                        
                        </div>
                        
                             <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
                        i was not sure if you wanted to see this. but here is what i am using to display the information.

                        Code:
                        <!---Shows what was previously entered into serial and description table--->
                        
                        <cfquery name="serial" datasource="CustomerSupport">
                        		SELECT pka_serialNo,pkb_fk_ticketNo,model_no,product_type,software_hardware,
                               resolution,resolution_date,verification_date,type_hardware_failure,
                                dept_responsibility,resolution_verified_by,fk_serialNo,fk_ticketNo,description
                                FROM dbo.tbl_CS_serial
                                LEFT JOIN dbo.tbl_CS_notes_descr
                                ON dbo.tbl_CS_serial.pkb_fk_ticketNo=dbo.tbl_CS_notes_descr.fk_ticketNo and
                                dbo.tbl_CS_serial.pka_serialNo=dbo.tbl_CS_notes_descr.fk_serialNo
                                WHERE pkb_fk_ticketNo = #URL.pk_ticketID# and fk_ticketNo = #URL.pk_ticketID#
                                ORDER BY pkb_fk_ticketNo
                        </cfquery>
                        
                        <!---Shows what was previously entered into parts table--->
                        <cfquery name="parts" datasource="CustomerSupport">
                               SELECT pk_partID,fk_serialNo,fk_ticketNo,hc_partNo,ltrim(rtrim(part_returned)) as        part_returned,rma_number,defective
                                 FROM dbo.tbl_CS_parts
                                 WHERE fk_ticketNo = #URL.pk_ticketID#
                        </cfquery>
                        Thank you,
                        Rach

                        Comment

                        • bonneylake
                          Contributor
                          • Aug 2008
                          • 769

                          Hey Acoder,

                          I know what the actual problem is! Your right it is the inserting more then once but its not with serial or parts. It turns out its with the one field called description (which has its own separate table ) is putting duplicates in its table!When i commented out the following lines. it did not insert duplicate. But when i had it uncommented it inserted duplicates.

                          here is where the problem lies
                          Code:
                          <!---Inserts information into notes_descr table.--->
                          <!---<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>--->

                          here is what i have in full

                          Code:
                          <cftransaction>
                          <!---Inserts information into serial table.--->
                          <cfquery name="deleteserialparts" datasource="CustomerSupport">
                          exec usp_CS_Deleteserialparts '#Form.pk_ticketID#'
                          </cfquery>
                          
                          <CFIF REQUEST_METHOD EQ "POST">
                          <CFSET machineListLen = listLen(Form.serialcount)>
                          <CFLOOP from="1" to="#machineListLen#" index="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]>
                          
                           
                          <!--- inserts information into the serial table--->
                          <cfquery name="serialinsertupdate" datasource="CustomerSupport">
                             exec usp_CS_Insertserial 
                               <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.--->
                          <!---<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>--->
                          
                          <!---Inserts parts information into parts table.--->
                          <!---because it is a bit we don't use 'ticks' around defective for parts table--->
                          <!---<cfloop list="#form['partscount' & machinecount]#" index="ps">
                          <cfparam name="Form.defective_#ps#_#machinecount#" default="0">
                          <cfparam name="Form.partsreturn_#ps#_#machinecount#" default="0">
                          <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
                          <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
                          <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
                          <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
                          <cfquery name="parts" datasource="CustomerSupport">
                              exec usp_CS_Insertparts 
                              <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="#defective#" CFSQLType = "CF_SQL_BIT">,
                              <cfqueryparam value="#rma#" CFSQLType = "CF_SQL_VARCHAR">
                          </cfquery>
                          </cfloop>--->
                          </CFLOOP>
                          </CFIF>
                          </cftransaction>
                          Thank you,
                          Rach

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            Excellent work (so far anyway)! At least you've found the problem spot. OK, can you show me the usp_CS_insertde scription query?

                            Comment

                            • bonneylake
                              Contributor
                              • Aug 2008
                              • 769

                              Originally posted by acoder
                              Excellent work (so far anyway)! At least you've found the problem spot. OK, can you show me the usp_CS_insertde scription query?
                              Hey Acoder,

                              yep sure can. But i do got a issue with the description. I am suppose to make it with the description where once a description is inserted it can not be edited. But they can view the descriptions that have been inserted. An they also have to be able to add descriptions. I was suppose to ask one of the other developers for help on this part since not sure how they wanted to do it. But wanted to bring this up because its pretty important.i was thinking of just making another page where they click on it an can view the descriptions but make it insert them the same way.but here is my stored procedure for the insert

                              Code:
                              set ANSI_NULLS ON
                              set QUOTED_IDENTIFIER ON
                              go
                              
                              
                              
                              -- =============================================
                              -- Author:		<Author,,Name>
                              -- Create date: <Create Date,,>
                              -- Description:	<Description,,>
                              -- =============================================
                              ALTER PROCEDURE [dbo].[usp_CS_Insertdescription] 
                              	-- Add the parameters for the stored procedure here
                                    (
                                    @fk_serialNo nvarchar(50),
                                    @fk_ticketNo numeric (18),
                                    @description nvarchar(500),
                                    @fk_addedBy nvarchar(100))
                              AS
                              BEGIN
                              	-- SET NOCOUNT ON added to prevent extra result sets from
                              	-- interfering with SELECT statements.
                              	SET NOCOUNT ON;
                              
                                  -- Insert statements for procedure here
                              	 insert into tbl_CS_notes_descr
                                   (fk_serialNo,fk_ticketNo,description,fk_addedBy)
                              
                                   values
                                   (@fk_serialNo,@fk_ticketNo,@description,@fk_addedBy)          
                               
                              END
                              Thank you,
                              Rach

                              Comment

                              • acoder
                                Recognized Expert MVP
                                • Nov 2006
                                • 16032

                                I think it may be caused by the fact that the delete stored procedure doesn't delete descriptions. Also, now you mention that you can have many descriptions for one serial, it changes things. The serial query uses a join query to get the description. This assumes a one-to-one relationship, but now you've got a one-to-many relationship, i.e. many descriptions to one serial. You'll have to change the query to keep serials and descriptions separate like how you have serials and parts separate. In other words, treat descriptions like parts.

                                Comment

                                Working...