Multiple serials with multiple parts attached to it.

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

    #76
    Originally posted by acoder
    It seems the part div ID is not unique. Try adding the serial no. to it to make it unique, e.g.
    Code:
    var partIdName = 'part' + count + 'Name' + serialno;

    Hey Acoder,

    Yep that was it.Thank you, Thank you!!! So heres the whole parts section done.

    Code:
    function addpartInput(partName){
    var parts = document.getElementById(partName);
    var getparts = document.getElementById('div');
    var serialno = partName.replace("dynamic","").replace("Input","");
    var avalue = document.getElementById("partscount"+serialno);
    var count = parseInt(avalue.value) + 1;
    avalue.value = count;
    var partdiv = document.createElement('div');
    var partIdName = 'part' + count + 'Name' + serialno;
    
    partdiv.setAttribute('id',partIdName);
    But anyway i was wondering. I talked to you about this earlier, but we had gotten on to another topic. How would make it so each part said this

    part 1 serial information 1

    basically so the user wont get confused because there will be a good amount of serials and parts being added an just want them to know what part goes with what serial.

    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #77
      I notice you have this line:
      Code:
      "<th class='sectiontitle' colspan='7'>Parts Information "+ count +" Serial Information <div id='dynamicInput'></div></th>" +
      I'm not sure why you have that dynamicInput div in there - remove it and put the serialno variable in there (like count) and you should be good to go.

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        #78
        Hey Acoder,

        I got just one more question an i should be able to figure out the rest "i hope". I am having trouble inserting the parts into the table. This is what i been trying

        Code:
        <!---Inserts information into serial table.--->
        <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 rma             = Form["rma_" & machineCount]>
         <CFSET thedescription  = Form["thedescription_" & machineCount]>
         <CFSET hcpn            = Form["hcpn_" & machineCount]>
         <CFSET partsreturn     = Form["partsreturn_" & machineCount]>
         <CFSET defective       = Form["defective_" & machineCount]>
        <!--- <CFSET followdate      = Form["followdate_" & machineCount]>
         <CFSET onsite          = Form["onsite_" & machineCount]>
         <CFSET numonsite       = Form["numonsite_" & machineCount]>--->
         
        <cfquery name="serial" datasource="CustomerSupport">
           exec usp_CS_Insertserial 
             <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
             '#Form.ID#',
             <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">,
             <cfqueryparam value="#rma#" 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.ID#',
           <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--->
        <cfquery name="parts" datasource="CustomerSupport">
            exec usp_CS_Insertparts 
            <cfqueryparam value="#serialnum#" CFSQLType = "CF_SQL_VARCHAR">,
            '#Form.ID#',
            <cfquery param value="#hcpn#" CFSQLType = "CF_SQL_VARCHAR">,
            <cfquery param value="#partsreturn#" CFSQLType = "CF_SQL_VARCHAR">,
            <cfquery param value="#defective#" CFSQLType = "CF_SQL_VARCHAR">,
        <!---    <cfquery param value="#submission#" CFSQLType = "CF_SQL_VARCHAR">--->
        </cfquery>
        
        </CFLOOP>
        </CFIF>
        and i get the error Just in time compilation error.An unknown attribute 'param' has been encountered. An it says it happens right in the insert parts information. An well was wondering. In the serial function i had this line at the end

        Code:
        "<input type='hidden' name='serialcount' value='" + count + "'>";
        do i need to add this line into parts? or do i need to create something else?

        Thank you,
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #79
          This is a Coldfusion problem. The cfqueryparam tags have a space between them.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            #80
            Originally posted by acoder
            This is a Coldfusion problem. The cfqueryparam tags have a space between them.
            Hey Acoder,

            Yeah i know its a coldfusion problem. But wanted to make sure this line

            Code:
            "<input type='hidden' name='serialcount' value='" + count + "'>";
            was not causing the trouble before having to start a new thread. Do i need this line in both the serial function and the parts function to make it insert correctly?

            Thank you,
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #81
              I doubt it from what I can see from the query, so I would suggest a new thread.

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                #82
                Originally posted by acoder
                I doubt it from what I can see from the query, so I would suggest a new thread.
                Hey Acoder,

                But do i need this line in the serial and parts function or just the serial function because right now have it in both

                Code:
                "<input type='hidden' name='serialcount' value='" + count + "'>";
                but started a new thread which here is the link



                But thank you again for all the help i really appreciate it, its awesome to see it working! Thank you Thank you!!!!!

                Thank you again :),
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #83
                  No, you wouldn't need that line in either function because you already have the counts, one for all serials and one each for parts in each serial.

                  And, of course, you're welcome!

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    #84
                    Originally posted by acoder
                    No, you wouldn't need that line in either function because you already have the counts, one for all serials and one each for parts in each serial.

                    And, of course, you're welcome!
                    Hey Acoder,

                    Are you sure i don't need the line at all? because in my cold fusion it uses that field for the count

                    Code:
                    <CFIF REQUEST_METHOD EQ "POST">
                    <CFSET machineListLen = listLen(Form.serialcount)>
                    <CFLOOP from="1" to="#machineListLen#" index="machineCount">
                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #85
                      Well, OK, you do need it, but you only need one, not one each for each serial. The one you need is the one with ID "theValue". Give it the name "serialcoun t". Likewise for parts counts, give them names so that they can be used in Coldfusion.

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        #86
                        Originally posted by acoder
                        Well, OK, you do need it, but you only need one, not one each for each serial. The one you need is the one with ID "theValue". Give it the name "serialcoun t". Likewise for parts counts, give them names so that they can be used in Coldfusion.
                        Hey Acoder,

                        So in the serial function put this

                        Code:
                        "<input type='hidden' name='serialcount' value='" + count + "'>";
                         
                        <!--- Adds Delete to every ticket  --->
                        newdiv.innerHTML = newdiv.innerHTML +
                        an to the parts function do this

                        Code:
                        "<input type='hidden' name='partscount' value='" + count + "'>";
                        
                         
                        <!--- Adds Delete to every ticket  --->
                        partdiv.innerHTML = partdiv.innerHTML +
                        correct?

                        Thank you,
                        Rach

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #87
                          No, you don't need any extra ones. You already have them within your code, so there's no need to create redundant elements.

                          The ones I'm talking about are the ones you've been using in your JavaScript code. The element in the HTML for serials and the multiple parts counts created in addInput() for parts.

                          Comment

                          • bonneylake
                            Contributor
                            • Aug 2008
                            • 769

                            #88
                            Originally posted by acoder
                            No, you don't need any extra ones. You already have them within your code, so there's no need to create redundant elements.

                            The ones I'm talking about are the ones you've been using in your JavaScript code. The element in the HTML for serials and the multiple parts counts created in addInput() for parts.
                            Hey Acoder,

                            Ok so saying to leave the one in serial function

                            Code:
                            "<input type='hidden' name='serialcount'  id="theValue" value='" + count + "'>";
                            and then for the parts put

                            Code:
                            "<input type='hidden' name='partc'  id="theValue" value='" + count + "'>";
                            Thank you,
                            Rach

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #89
                              No, you don't need any more at all. You can just use the ones that you're already using: "theValue" in the HTML just above the "dynamicInp ut" div and "partscount 1", "partscount 2", etc. in the addInput function.

                              Comment

                              • bonneylake
                                Contributor
                                • Aug 2008
                                • 769

                                #90
                                Originally posted by acoder
                                No, you don't need any more at all. You can just use the ones that you're already using: "theValue" in the HTML just above the "dynamicInp ut" div and "partscount 1", "partscount 2", etc. in the addInput function.
                                Hey Acoder,

                                Alrighty i understand now. Do i need to remove the other value i have in the html as well? these are the 2 i have in the html

                                Code:
                                <input type="hidden" value="0" id="theValue" />
                                <input type="hidden" value="0" id="aValue" />
                                Thank you,
                                Rach

                                Comment

                                Working...