how to loop through this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #31
    Ah, I see you use the "theValue" hidden input for the count. In that case instead of setting a global variable, set the hidden variable and you can set it directly without using JavaScript:
    Code:
    <input type="hidden" value="#count#" id="theValue" />

    Comment

    • bonneylake
      Contributor
      • Aug 2008
      • 769

      #32
      Originally posted by acoder
      Ah, I see you use the "theValue" hidden input for the count. In that case instead of setting a global variable, set the hidden variable and you can set it directly without using JavaScript:
      Code:
      <input type="hidden" value="#count#" id="theValue" />
      Hey Acoder,

      I am still running into the same problem. I bolded where i added it at an have not messed with the javascript.

      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>[B]<input type="hidden" value="#count#" id="theValue" />[/B]
      <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>
           <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
      Thank you,
      Rach

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #33
        The first thing to check is that it's within cfoutput. Also don't forget to remove the first line which has a duplicate (now no longer needed).

        Comment

        • bonneylake
          Contributor
          • Aug 2008
          • 769

          #34
          Originally posted by acoder
          The first thing to check is that it's within cfoutput. Also don't forget to remove the first line which has a duplicate (now no longer needed).
          Hey Acoder,

          Well taking out the first line the value part seemed to help the count better. If i have one previously serial it seems to work perfectly the count. But if have more the one is when i run into problems. If i have serial 1 and serial 2 if i go to add another it makes it serial 2. But new line is within the cfouput. But here is what i have

          Code:
          <!--- Ticket Information 
                 This display the ticket Information--->
              
          <!---<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" value="#count#" id="theValue" />
          <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>
               <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
          Thank you,
          Rach

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #35
            The line
            Code:
            var count = (document.getElementById('theValue').value -1)+ 2;
            seems to add one to the count. Try:
            Code:
            var count = parseInt(document.getElementById('theValue').value)+ 1;
            and see if that makes a difference.

            Comment

            • bonneylake
              Contributor
              • Aug 2008
              • 769

              #36
              Originally posted by acoder
              The line
              Code:
              var count = (document.getElementById('theValue').value -1)+ 2;
              seems to add one to the count. Try:
              Code:
              var count = parseInt(document.getElementById('theValue').value)+ 1;
              and see if that makes a difference.
              Hey Acoder,

              That didn't seem to do anything to it. But i do got another question to ask you, i have a part in the form called remove an well was wondering how i could change this from javascript to html. i understand till the count part but past that i can't seem to get it right and get errors when i tried. here is what i have

              Code:
              <input type="button" class="removeticket" value="Remove Serial &quot;'+count +'&quot;" onclick=\"removeElement(\'"+divIdName+"\')\">
              but here is the beginning of the javascript if you want to see it again
              Code:
              function addInput(divName){
              var dynamic = document.getElementById('dynamicInput');
              var thevalue = document.getElementById('theValue');
              <!---var count = parseInt(document.getElementById('theValue').value )+ 1;--->
              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);
              Thank you again for all the help :),
              Rach

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #37
                That could be something like:
                Code:
                <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('#divIdName#')">
                Where is this going to go?

                For the count, check the value in the source. Say with two records, is it two? In addInput (the JavaScript function), check the value of theValue.

                Comment

                • bonneylake
                  Contributor
                  • Aug 2008
                  • 769

                  #38
                  Originally posted by acoder
                  That could be something like:
                  Code:
                  <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('#divIdName#')">
                  Where is this going to go?

                  For the count, check the value in the source. Say with two records, is it two? In addInput (the JavaScript function), check the value of theValue.
                  Hey Acoder,

                  The remove part is going where you see the previously entered fields. The serial can add and remove fields (an needs to be able to remove previously entered fields and not just the new serials added).

                  but i looked at the source an its strange although it says serial information 2 twice (if i click add serial) it only shows serial information 1 and serial information 2 but does not show what i just added, it shows the previously added fields but does not show when i click add serial. I also just noticed that when i click add this is what happens.

                  serial information 1
                  displays previous entry

                  serial information 2
                  displays nothing

                  serial information 2
                  displays previous entry

                  i am not sure if that means anything. an in the javascript how do i make it check the value of theValue. because doesn't it do it right here or am i confused?
                  Code:
                  var count = (document.getElementById('theValue').value -1)+ 2;
                  thevalue.value = count;
                  Thank you,
                  Rach

                  Comment

                  • acoder
                    Recognized Expert MVP
                    • Nov 2006
                    • 16032

                    #39
                    For the remove button to work, you're going to have to enclose each previously entered ticket in a div with a unique id, so that you can pass that to the remove function. This ID can be what you use in JavaScript, i.e. "dynamic#count# Input".

                    The source will only show the source on page load. It won't show the code generated by JavaScript (though some browsers can allow you to see that with addons, for example).

                    From what you describe, it seems that the addInput is adding the table in between the two serials rather than at the end. Check the HTML tags all match up correctly and you haven't got tags mixed up, e.g. the closing div tag in the loop.

                    Comment

                    • bonneylake
                      Contributor
                      • Aug 2008
                      • 769

                      #40
                      Originally posted by acoder
                      For the remove button to work, you're going to have to enclose each previously entered ticket in a div with a unique id, so that you can pass that to the remove function. This ID can be what you use in JavaScript, i.e. "dynamic#count# Input".

                      The source will only show the source on page load. It won't show the code generated by JavaScript (though some browsers can allow you to see that with addons, for example).

                      From what you describe, it seems that the addInput is adding the table in between the two serials rather than at the end. Check the HTML tags all match up correctly and you haven't got tags mixed up, e.g. the closing div tag in the loop.
                      Hey Acoder,

                      Ok i got the addInput to work better now (you was right the closeing div tag was inside the loop). But here is what it is doing now. the serial 1 and 2 are the ones i previously entered and the serial 2 below the first serial 2 and 3 are ones that i added. but here is an example of how it looks

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

                      i created a new div but i don't think i did it correctly. An i am getting errors with the remove button saying undetermined string constant.

                      i bolded everything i added/changed. here is everything inside the div

                      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 = 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#>
                      <cfif serial.recordcount is 0></cfif>
                      <cfset count = count + 1>
                      [B]<div id="dynamic#count#Input">[/B]
                      <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">
                      ( 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" value="#count#" name="theValue" id="theValue" />
                      <input type="hidden" name="serialcount" value="#count#">
                       
                      <!--- Adds Delete to every ticket  --->
                      <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                      <tr>
                      <td>
                      [B]<input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('#divIdName#')">[/B]
                      </td>
                      </tr>
                      </table>
                      [B]</div>[/B]
                      </cfoutput>
                      </div>
                           <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
                      an didn't know if you wanted to see this but here is the javascript

                      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 = parseInt(document.getElementById('theValue').value )+ 1;--->
                      <!---var count = (document.getElementById('theValue').value -1)+ 2;
                      thevalue.value = count;--->
                      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

                      • acoder
                        Recognized Expert MVP
                        • Nov 2006
                        • 16032

                        #41
                        In the removeElement call, #divIdName# should be dynamic#count#I nput because that's the name of the div.

                        As for the count, the reason for the problems is that the hidden input field "theValue" should be outside the loop.

                        Comment

                        • bonneylake
                          Contributor
                          • Aug 2008
                          • 769

                          #42
                          Originally posted by acoder
                          In the removeElement call, #divIdName# should be dynamic#count#I nput because that's the name of the div.

                          As for the count, the reason for the problems is that the hidden input field "theValue" should be outside the loop.
                          Hey Acoder,

                          The remove is working correctly :). But theValue is not, when i took it an put it outside now when i click add i get serial information NaN. I bolded where i added it at

                          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 = 0>
                          <!---<cfif serial.recordcount is 0></cfif>--->
                          [B]<input type="hidden" value="#count#" name="theValue" id="theValue" />[/B]
                          <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>
                          <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">
                          ( 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+"\')\">--->
                          <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
                          </td>
                          </tr>
                          </table>
                          </div>
                          </cfoutput>
                          </div>
                               <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
                          Thank you :),
                          Rach

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            #43
                            Two things: you should put it after the loop and #count# needs to have <cfoutput> tags around it.

                            Comment

                            • bonneylake
                              Contributor
                              • Aug 2008
                              • 769

                              #44
                              Originally posted by acoder
                              Two things: you should put it after the loop and #count# needs to have <cfoutput> tags around it.
                              Hey Acoder,

                              I put it after an now it don't display previously entered fields, but when i click add it gets the right number. Bolded where i added it.

                              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>
                              <!---<cfif serial.recordcount is 0></cfif>--->
                              <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>
                              <div id="dynamic#count#Input">
                              <cfif serial.recordcount is 0>
                              <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">
                              ( 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+"\')\">--->
                              <input type="button" class="removeticket" value="Remove Serial #count#" onclick="removeElement('dynamic#count#Input')">
                              </td>
                              </tr>
                              </table>
                              </cfif>
                              </div>
                              </cfoutput>
                              [B]<input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />[/B]
                              </div>
                                   <input type="button" class="addticket" value="Add Serial" onClick="addInput('dynamicInput');" >
                              Thank you,
                              Rach

                              Comment

                              • acoder
                                Recognized Expert MVP
                                • Nov 2006
                                • 16032

                                #45
                                That's because of the line:
                                Code:
                                <cfif serial.recordcount is 0>
                                as I mentioned in the other thread. You can remove it unless it's required in which case copy and remove from there and add to the end.

                                Comment

                                Working...