how to loop through this?

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

    #16
    Originally posted by acoder
    Does it show three "Serial Information" headers?

    You can increment the #count# (set it to 1 to begin with) at the end of the loop:
    Code:
    <cfset count = count + 1>
    I've not seen the CSS classes, so not sure how that affects things, but if it's showing side by side, then you could add some spacing at the bottom (end of the loop), e.g. a couple of <br> tags.
    Hey Acoder,

    Yes it shows 3 serial information headers. Just shows all the fields next to each other.

    example

    serial information 1

    serial 1, serial 2, serial 3

    serial information 2

    serial 1, serial 2, serial 3

    an what i am trying to do is

    serial information 1

    serial 1

    serial information 2

    serial 2

    I don't think the css has to do with anything because it only makes the design (color, align center), the only thing that could affect is is the table. but do i think i need to change the table to accomplish this?

    Code:
        <div id="dynamicInput">
         <!--- All Ticket Information Appears Here--->
        <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
    
    <cfoutput query="serial">
    <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;
    <cfloop query="serial" ><input type="text" name="serialnum_' + count + '" value="#pka_serialNo#"></cfloop>
    &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">
    ( You may enter up to 500 characters. )
    <br>
    <cfloop query="description"><textarea maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="thedescription_' + count + '">#description#</textarea></cfloop> 
    </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 500 characters. )
    <br>
    <cfloop query="serial"><textarea  maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="resolution_' + count + '">#resolution#</textarea></cfloop>
    </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>
    <cfloop query="serial"><input type="text" name="resdate_' + count + '" value="#resolution_date#">&nbsp;&nbsp;</cfloop>
     
    &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">
    <cfloop query="serial"><input type="text" name="vertifidate_' + count + '" value="#verification_date#">&nbsp;&nbsp;</cfloop>
    &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>
     
    <!--- 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 500 characters. )
    <br/>
    <cfloop query="serial"><textarea maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="rma_' + count + '" >#rma_data#</textarea></cfloop>
    </td>
    </tr>
    </table>
    <input type="hidden" name="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 &quot;'+count +'&quot;" onclick=\"removeElement(\'"+divIdName+"\')\">--->
    </td>
    </td>
    </tr>
    </table>
    </cfoutput>
    
         </div>
    also wanted to ask the way am doing it, is it going to have a problem with the count? because original the way it keeps count of everything added and deleted was using the javascript. an i am afraid of is if i have a serial information 1 in the div and i go an add a serial and its called serial information 1 that it will get over written instead of keeping the original serial information 1 and adding the other serial information 1. Hope that makes since mostly worried about the count an how that will work since now its not in the javascript.

    Thank you for all the help,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #17
      Within the code you have <cfloop query="serial"> This is the cause of the problem. It's looping within the loop. Remove the "serial" loops. You can keep the rest because they're just populating drop downs, etc., though you could probably have it grab the output in variable and output that instead of looping over the same queries over and over again.

      As for the JavaScript, that can be solved by outputting the Coldfusion count variable within the JavaScript code.

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        #18
        Hey Acoder,

        Yep that works, can't believe i didn't notice it! But ok so how do i output the coldfusion count variable within the javascript code?

        Thank you :),
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #19
          Something as simple as
          Code:
          var count = <cfoutput>#count#</cfoutput>;
          This assumes that the count value in Coldfusion is correct, of course.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            #20
            Originally posted by acoder
            Something as simple as
            Code:
            var count = <cfoutput>#count#</cfoutput>;
            This assumes that the count value in Coldfusion is correct, of course.
            Hey Acoder,

            Ok so me and count are not getting along so well (havent added what you added above just yet). But i get the error of Error resolving parameter COUNT here is what i have tried

            Code:
            <div id="dynamicInput">
                 <!--- All Ticket Information Appears Here--->
                <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
            
            
            <cfset count = count + 1>
            <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#>
            <table class="zpExpandedTable" id="modeltable"> 
            <th class="sectiontitletick" colspan="7">
            Serial Information #count# </th>
            <tr>
            Do i need to do something like <cfset count = 0> before the cfset you have?

            Thank you,
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #21
              Yes, count will have to be set to 0 or 1 to begin with.

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                #22
                Originally posted by acoder
                Yes, count will have to be set to 0 or 1 to begin with.
                Hey Acoder,

                Ok with the count it keeps giving me the same number. Here is what i have

                Code:
                <cfset count = 1>
                <cfset count = count + 1>
                It keeps giving me right now serial information 2, serial information 2, serial information 2. any ideas?

                Thank you,
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #23
                  The count needs to be incremented within the loop.

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    #24
                    Originally posted by acoder
                    The count needs to be incremented within the loop.
                    Hey Acoder,

                    Do i need to create its own loop for it? because here is what i have

                    Code:
                    <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#>
                    <table class="zpExpandedTable" id="modeltable"> 
                    <th class="sectiontitletick" colspan="7">[B]<cfset count = 1>
                    <cfset count = count + 1>
                    Serial Information #count# </th>[/B]
                    <tr>
                    <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #25
                      The first cfset which sets the initial value should be outside the loop. The incrementing within the loop.

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        #26
                        Originally posted by acoder
                        The first cfset which sets the initial value should be outside the loop. The incrementing within the loop.
                        Hey Acoder,

                        Its counting correctly, but where do i put the
                        Code:
                        var count = <cfoutput>#count#</cfoutput>;
                        part?

                        This is where i had put it, but it says Error resolving parameter COUNT

                        Code:
                        <script type="text/javascript">
                         <!---Allows us to add serial information multiple times --->
                        function addInput(divName){
                        var dynamic = document.getElementById('dynamicInput');
                        var thevalue = document.getElementById('theValue');
                        var count = (document.getElementById('theValue').value -1)+ 2;
                        thevalue.value = count;
                        [B]var count = <cfoutput>#count#</cfoutput>;[/B]
                        var newdiv = document.createElement('div');
                        var divIdName = 'dynamic'+count+'Input';
                        newdiv.setAttribute('id',divIdName);
                        Thank you,
                        Rach

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #27
                          It'd have to be after the count has been set, so you could have a script that sets the count after the div, e.g.
                          Code:
                          </div>
                          <script type="text/javascript">
                          var count = <cfoutput>#count</cfoutput>;
                          </script>
                          This is probably not best practice if you want to keep JavaScript code in the head in which case you can use cfhtmlhead.

                          Comment

                          • bonneylake
                            Contributor
                            • Aug 2008
                            • 769

                            #28
                            Originally posted by acoder
                            It'd have to be after the count has been set, so you could have a script that sets the count after the div, e.g.
                            Code:
                            </div>
                            <script type="text/javascript">
                            var count = <cfoutput>#count</cfoutput>;
                            </script>
                            This is probably not best practice if you want to keep JavaScript code in the head in which case you can use cfhtmlhead.
                            Hey Acoder

                            it really aint working like it needs to doing it that way. What it does is if i have 2 serials. serial information 1 serial information 2. if i add another serial it changes the serial information 2 to a serial information 1. an if i add another it does this

                            serial information 1
                            serial information 1
                            serial information 2
                            serial information 2

                            its just not counting right, would adding into the javascript help? an what would i need to change to add it to the javascript?

                            Thank you,
                            Rach

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #29
                              Can you show the current version of your code?

                              Comment

                              • bonneylake
                                Contributor
                                • Aug 2008
                                • 769

                                #30
                                Originally posted by acoder
                                Can you show the current version of your code?
                                Hey Acoder,

                                Ok here is the div part

                                Code:
                                <input type="hidden" value="0" id="theValue" />
                                     <div id="dynamicInput">
                                     <!--- All Ticket Information Appears Here--->
                                    <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
                                
                                <cfset count = 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#>
                                <table class="zpExpandedTable" id="modeltable"> 
                                <th class="sectiontitletick" colspan="7">
                                <cfset count = count + 1>
                                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">
                                ( You may enter up to 500 characters. )
                                <br>
                                <cfloop query="description"><textarea maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="thedescription_' + count + '">#description#</textarea></cfloop> 
                                </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 500 characters. )
                                <br>
                                <textarea  maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(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="#resolution_date#">&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="#verification_date#">&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>
                                 
                                <!--- 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 500 characters. )
                                <br/>
                                <textarea maxlength="500" onkeyup="return ismaxlength(this)" onkeydown="return ismaxlength(this)" rows="4" cols="60" name="rma_' + count + '" >#rma_data#</textarea>
                                </td>
                                </tr>
                                </table>
                                <input type="hidden" name="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 &quot;'+count +'&quot;" onclick=\"removeElement(\'"+divIdName+"\')\">--->
                                </td>
                                </tr>
                                </table>
                                
                                     </div>
                                </cfoutput>
                                     <script type="text/javascript">
                                var count = <cfoutput>#count#</cfoutput>
                                </script>
                                     <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >




                                an here is the javascript part

                                Code:
                                <script type="text/javascript">
                                
                                
                                 <!---Allows us to add serial information multiple times --->
                                function addInput(divName){
                                var dynamic = document.getElementById('dynamicInput');
                                var thevalue = document.getElementById('theValue');
                                var count = (document.getElementById('theValue').value -1)+ 2;
                                thevalue.value = count;
                                var newdiv = document.createElement('div');
                                var divIdName = 'dynamic'+count+'Input';
                                newdiv.setAttribute('id',divIdName);
                                 
                                <!--- Adds Extra fields for Model No, Product Type, and Type of Hardware Failure  --->
                                newdiv.innerHTML =
                                "<table class='zpExpandedTable' id='modeltable'>" +
                                "<th class='sectiontitletick' colspan='7'>Serial Information "+ count +" </th>" +
                                "<tr>" +
                                "<td id='paddingformultitop'>Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>" +
                                "</td>" +
                                "<td>" +
                                 "<select name='modelno_" + count + "' >" +
                                 "<option value=''>Make A Selection</option>" +
                                "<cfoutput query='models'>" + 
                                "<option value='#model#'>#model#</option>" + 
                                "</cfoutput>" + 
                                 "</select>" +
                                 "</td>" +
                                 "<td>" +
                                "&nbsp;&nbsp;&nbsp;&nbsp;Product Type:"  +
                                "</td>" +
                                "<td>" +
                                "<select name='producttype_" + count + "'>" +
                                "<option value='' selected>No Choice</option>" +
                                "<cfoutput query='getProdType'>" + 
                                "<option value='#pk_productType#'>#pk_productType#</option>" + 
                                "</cfoutput>" + 
                                "</select>" +
                                "</td>" +
                                "<td class='red'>" +
                                "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type Of Hardware Failure*:" +
                                "</td>" +
                                "<td>" +
                                "<select name='hardwarefailure_" + count + "'>" +
                                "<option value='' selected>Make A Selection</option>" +
                                "<cfoutput query='getHardwareFail'>" +
                                "<option value='#pk_hardwareFailure#'>#pk_hardwareFailure#</option>" +
                                "</cfoutput>" +
                                "</select>" +
                                "</td>" +
                                "</tr>" +
                                "<table>";
                                 
                                <!--- Adds Extra fields for Serial Number and Software/Hardware  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='modeltable'>" +
                                "<tr>" +
                                "<td id='paddingformultitop'>" +
                                "Serial Number:&nbsp;&nbsp;" +
                                "<input type='text' name='serialnum_" + count + "'>" +
                                "&nbsp;&nbsp;&nbsp;&nbsp;Software/Hardware:&nbsp;&nbsp;" +
                                "<select name='softhardware_" + count + "'>" +
                                "<option value='' selected>No Choice</option>" +
                                "<cfoutput query='getSoftHard'>" + 
                                "<option value='#pk_softwareHardware#'>#pk_softwareHardware#</option>" + 
                                "</cfoutput>" + 
                                "</select>" +
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                
                                <!--- Adds Extra fields for Description  --->
                                newdiv.innerHTML = newdiv.innerHTML + 
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='3' cellspacing='0'>" +
                                "<tr>" +
                                "<td id='paddingformutli'>" +
                                "Description:&nbsp;&nbsp;" + 
                                "</td>" +
                                "<td class='descriptionmoveinmulti'>" +
                                "( You may enter up to 500 characters. )"+
                                "<br>" +
                                "<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)'rows='4' cols='60' name='thedescription_" + count + "'></textarea>" + 
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                 
                                <!--- Adds Extra fields for Resolution  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td id='paddingformutli'>" +
                                "Resolution:&nbsp;&nbsp;" +
                                "</td>" +
                                "<td class='resolutionmoveinmulti'>" +
                                "( You may enter up to 500 characters. )"+
                                "<br>" +
                                "<textarea  maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='resolution_" + count + "'></textarea>" +
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                 
                                <!--- Adds Extra fields for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoldatetab' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td id='paddingformultitop'>" +
                                "Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
                                "</td>" +
                                "<td>" +
                                "<input type='text' name='resdate_" + count + "' value=''  >&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>" +
                                "<cfoutput query='gettech'><option value='#fname# #lname#'>#fname# #lname#</option></cfoutput></select>" +
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                 
                                <!--- Adds Extra fields for Vertification Date, Current Date (for vertification date) and resolution vertified as effective by  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td id='paddingformultitop'>" +
                                "Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;" +
                                "</td>" +
                                "<td class='vertificationmoveinmulti'>" +
                                "<input type='text' name='vertifidate_" + count + "'>&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>";
                                 
                                <!--- Adds Extra fields for Dept/Vendor Responsibility  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td class='red' id='paddingformultitop'>" +
                                "Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  +
                                "<select name='deptvendor_" + count + "'>" +
                                "<option value='' selected>Make A Selection</option>" +
                                "<cfoutput query='getDeptVendor'>" +
                                "<option value='#pk_deptVendor#'>#pk_deptVendor#</option>" +
                                " </cfoutput>" +
                                "</select>" +
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                 
                                <!--- Adds Extra fields for RMA Data Only  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td id='paddingformultitop'>" +
                                "RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;" +
                                "</td>" +
                                "<td class='rmanmoveinmulti'>" +
                                "( You may enter up to 500 characters. )"+
                                "<br/>" +
                                "<textarea maxlength='500' onkeyup='return ismaxlength(this)' onkeydown='return ismaxlength(this)' rows='4' cols='60' name='rma_" + count + "'></textarea> " +
                                "</td>" +
                                "</tr>" +
                                "</table>" +
                                "<input type='hidden' name='serialcount' value='" + count + "'>";
                                 
                                <!--- Adds Delete to every ticket  --->
                                newdiv.innerHTML = newdiv.innerHTML +
                                "<table class='zpExpandedTable' id='resoltable' cellpadding='1' cellspacing='0'>" +
                                "<tr>" +
                                "<td>" +
                                "<input type='button' class='removeticket' value='Remove Serial &quot;"+count +"&quot;' onclick=\"removeElement(\'"+divIdName+"\')\"></a>" +
                                "</td>" +
                                "</td>" +
                                "</tr>" +
                                "</table>";
                                 
                                document.getElementById(divName).appendChild(newdiv);
                                } 
                                 
                                 
                                <!---Allows us to remove multiple fields --->
                                function removeElement(divNum) {
                                  var d = document.getElementById('dynamicInput');
                                  var olddiv = document.getElementById(divNum);
                                  d.removeChild(olddiv);
                                }
                                
                                </script>
                                Thank you,
                                Rach

                                Comment

                                Working...