displaying previously entered multiple fields

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

    Hey Acoder,

    I tried the line 14 onwards an well i had to take out the last cfoutput. An well when i looked at the test ticket with the serial that i filled in just a few fields it worked correctly. However, when i looked at the serial where no serial had been inserted it now makes the serial say serial #count# information

    Code:
    <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
    <div id="dynamic#count#Input"> 
    <table class="zpExpandedTable" id="modeltable"> 
    <th class="sectiontitletick" colspan="7">
    Serial Information #count# </th>
    <tr>
    <td id="paddingformultitop">Model No:&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </td>
    <td>
    <select name="modelno_#count#">
    <option value="">Make A Selection</option>
    <cfloop query="models">
    <option value="#model#">#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#">#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#">#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="">
    &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#">#pk_softwareHardware#</option>
    </cfloop>
    </select>
    </td>
    </tr>
    </table>
    
    <!--- Shows what was previously entered for Description ---> 
    
     <cfquery name="getnotes" dbtype="query" >
    SELECT *
    FROM notes
    WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
    cfsqltype="cf_sql_char" maxLength="20">
    </cfquery>
    <cfloop query="getnotes">
    
    <input type="hidden" name="pk_num_#count#" id="pk_num" value="" /></cfloop>
    <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
    scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
    <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
    <tr><td id="paddingformutli">
    Previously Submitted Descriptions:</td><td id="paddingformutli">
    <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
    <cfloop query="getnotes">
    Added By:  <br/>
    Dated Added: <br/><br/>
    <div id="line"></div>
    </cfloop></div></td>
    
    </tr>
    </table>
    <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
    <tr>
    <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
    <td id="paddingformutli">
    Description:&nbsp;&nbsp;
    </td>
    <td class="descriptionmoveinmulti">
    
    ( You may enter up to 1000 characters. )
    <br>
    <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
    
    </td>
    </tr>
    </table>
    <!---Shows what was previously entered for Resolution ---> 
    
    <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
    <tr>
    <td id="paddingformutli">
    Resolution:&nbsp;&nbsp;
    </td>
    <td class="resolutionmoveinmulti">
    ( You may enter up to 1500 characters. )
    <br>
    <textarea  maxlength="1500" onKeyUp="return resolutionismaxlength(this)" onKeyDown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#"></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="">&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#">#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="">&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#">#pk_deptVendor#</option>
    </cfloop>
    </select>
    </td>
    </tr>
    </table>
    <input type="hidden" name="serialcount" id="serialcount" value="#count#">
    
    
    
    <!--- Adds Delete to every ticket  --->
    <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
    <tr>
    <td>
    <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
    </td>
    </tr>
    <tr>
    <td>
    <input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamic#count#Input')">
    </td>
    </tr>
    </table>
    
    
    <!---Shows what was previously entered into parts table--->
    <!---dbtype="query"--->
    <cfquery name="getparts" dbtype="query" >
    SELECT *
    FROM parts
    WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
    cfsqltype="cf_sql_char" maxLength="20">
    </cfquery>
    <cfset count1 = 0>
    <!---<cfif serial.recordcount is 0>--->
    <cfloop query="getparts">
    <cfset count1 = count1 + 1>
    <div id="part#count1#Name#count#">
    <!---<cfset partliststr = "">
    <cfloop from="1" to="#count1#" index="pl">
    <cfset partliststr = partliststr & #pl# & ",">
    </cfloop>
    
    <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
    <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
    
    <!---THIS IS THE PARTS SECTION--->
    
    <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="" />
    
    <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
    <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
    <tr>
    <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value=""></td>
    <td>
    Parts been returned*
    <input type="checkbox" name="partsreturn_#count1#_#count#" value=""/>
    </td>
    <td>
    <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#"/></td>
    </td>
    </tr>
    </table>
    <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
    
    
    <!--- Shows what was previously entered for RMA Data Only  --->
    <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
    <tr>
    <td id="paddingformultitop">
    RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td class="rmanmoveinmulti">
    ( You may enter up to 1000 characters. )
    <br/>
    <textarea maxlength="1000" onKeyUp="return rmaismaxlength(this)" onKeyDown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" ></textarea>
    </td>
    </tr>
    </table>
    
    
    <!--- Adds Delete to every ticket  --->
    <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
    <tr>
    <td>
    <input type="button" class="removeticket" value="Remove Parts #count1#" 
    onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
    </td>
    </td>
    </tr>
    </table>
    </div>
    <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
    </cfloop>
    </div>
    <!---this one makes it so you can add a part to a previously submitted serial--->
    <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      Yes, you'll need a cfoutput tag outside the template.

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        Hey Acoder,

        I am confused so are you saying i do or do not need the last <cfoutput> in the template. An if i don't need it then how do i make it when i didn't fill in a serial, how do i make the template count correctly cause right now it says serial #count# information if i did not fill in a serial.I tried wrapping the whole thing in just <cfoutput> that seemed to work except when you look at the didn't fill in a serial one it makes the serial serial 0 information.

        Also, could you explain the serial ordering part. I been looking and trying things all day but i cant seem to get it an it has my curiosity sparked. The only thing i have found online is that people created another field and made it a primary key an they made the data type int and set identiity specification to yes. Which is how my parts is like except i use the id_helper to generate the number instead of idenitity. But i not sure if thats what i need or not. An also when i tempted to try it said that the primary key or unique constraint cannot be changed until its existing relationships are deleted. Do you want to delete the relationship? an well i was afraid it would mess with what we had already done.But would this be a good way to do it or another way to go about it? the biggest problem is for some reason in the parts table the parts are not in order, But yet the serial is in order. would doing this solve the problem of things being in order and instead just put it how i inserted it? in my parts table it puts the fk_ticketNo in order like 2,3,4.An the serials in the order i inserted it like if i did 60, 55 it shows it as

        part 1 fk_serialno 60 fk_ticketNo 2 hcpn 6
        part 2 fk_serialNo 55 fk_ticketNo2 hcpn 5

        Thank you,
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          Originally posted by bonneylake
          I tried wrapping the whole thing in just <cfoutput> that seemed to work except when you look at the didn't fill in a serial one it makes the serial serial 0 information.
          To correct this, add a line outside the template which sets count to 1.

          Originally posted by bonneylake
          Also, could you explain the serial ordering part.
          Using a unique field primary key (which increments automatically on each insert) would work. What's the current primary key(s)? You could use a field which is not a primary key, but unique.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            Hey Acoder,

            The template works perfectly!

            The fields i currently have are the following

            primary key pka_serialNo nvarchar(100) allows nulls
            primary key pkb_fk_ticketNo nvarchar(100) allows nulls
            model_no nvarchar(50) does not allow nulls
            product_type nvarchar(100) does not allow nulls
            software_hardwa re nvarchar(40) does not allow nulls
            resolution nvarchar(1500) does not allow nulls
            resolution_date datetime does not allow nulls
            verification_da te datetime does not allow nulls
            type_hardware_f ailure nvarchar(100) allows nulls
            dept_responsibi lity nvarchar(40) does not allow nulls
            resolution_veri fied_by nvarchar(50) does not allow nulls

            the only fields i have in the form that are required are type_hardware_f ailure and dept_responsibi lity. But i was thinking about doing the other idea an creating another primary key because in all my other fields i have a similar count except in the serial table. But the only bad thing is, is i already got 2 primary keys as is so i don't know if its a good idea or not.

            Thank you,
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              Since the template's working and is basically a copy of the code in the main page, replace that code with the template. This will be more efficient and mean that whenever you make a change, you don't have to make the change in two places.

              For the sorting, you could use a unique field that is not a primary key. It can be an autonumber field that increments whenever an update is made. This also means you don't need to change any of your insert/update/delete queries.

              A question though: why are the two primary keys allowed to be null?

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                Hey Acoder,

                The thing is what i have on the main page is each field has a value like for example <input type="text" value="#serialn um#"> and on my template i have no value an just have <input type='text" value=""> so should i still take everything out of the main page an put the template?

                an i got the count working i added the field pk_snum int allows nulls an then i set idenity specification to yes. But i was wondering is there a way to reset the identity? right now it starts off at 25 an like to set it back to 1 if it was possible so it has a fresh start.


                an i have no clue why the primary keys allow nulls because i didn't create it.but all the other tables have the same thing applied to there primary keys as well so no clue.

                Thank you,
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  The template was supposed to be exactly the same as the main page code including #serialnum# and other variable values. For serial count 0, you would set these to empty strings, so that even though they're set in the template, they're not set to anything.

                  For the identity field, numbers are not important as long as you can order by insertion order.

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    Hey Acoder,

                    yes i can order by insertion number. I created it an then in my cfquery for serial i added Order by pk_snum an it worked perfectly. Was just trying to figure out if there was away to reset the count to 1 because it started off at 20.

                    An i am confused by the template part. So basically i was suppose to just make a copy of everything between the serial div, wrap it in cfoutput an then cfset the count to 1 an was not suppose to change the value from having a value to blank correct?

                    so basically i need to take out everything out starting at the serial div in the main file, replace it with the template from cfset count 1 to the </cfoutput> correct? An then what do i do with the below that appears below the serial div?

                    Code:
                    <!---If have any blanks in serial table it will make field appear--->
                    <cfoutput query="serial">
                    <cfset model_no = #model_no#>
                    <cfset product_type = #product_type#>
                    <cfset type_hardware_failure = #type_hardware_failure#>
                    <cfset pka_serialNo = #pka_serialNo#>
                    <cfset software_hardware = #software_hardware#>
                    <!---<cfloop query="getnotes">
                    <cfset description = #description#></cfloop>--->
                    <cfset resolution = #resolution#>
                    <cfset resolution_date = #resolution_date#>
                    <cfset resolution_verified_by = #resolution_verified_by#>
                    <cfset verification_date = #verification_date#>
                    <cfset dept_responsibility = #dept_responsibility#>
                    </cfoutput>
                    <cfif serial.recordcount is 0>
                    <cfset model_no = "">
                    <cfset product_type = "">
                    <cfset type_hardware_failure = "">
                    <cfset pka_serialNo = "">
                    <cfset software_hardware = "">
                    <!---<cfif getnotes.recordcount is 0>
                    <cfset description = ""></cfif>--->
                    <cfset resolution = "">
                    <cfset resolution_date = "">
                    <cfset resolution_verified_by = "">
                    <cfset verification_date = "">
                    <cfset dept_responsibility = "">
                    <cfinclude template="serialpartsdisplay.cfm">
                    </cfif>
                    
                    <!---Parts Information, display parts if have or don't have a value--->
                    <cfoutput query="parts">
                    <cfset hc_partNo = #hc_partNo#>
                    <cfset part_returned = #part_returned#>
                    <cfset defective = #defective#>
                    <cfset rma_number = #rma_number#>
                    <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
                    </cfoutput>
                    <cfif parts.recordcount is 0>
                    <cfset hc_partNo = "">
                    <cfset part_returned = "">
                    <cfset defective = "">
                    <cfset rma_number = "">
                    <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
                    </cfif>
                    
                    <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
                    </div>
                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      Yes, that's what I meant. Basically, what you have is:
                      Code:
                      <cfoutput query="serials">
                      <cfinclude template...>
                      </cfoutput>
                      <cfif serials.recordcount is 0>
                      <cfset some default values (same names as query)>
                      <cfinclude template...>
                      </cfif>

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        Hey Acoder,

                        Here is what i got in full would this be correct?

                        Code:
                        MAIN DIV WOULD BE HERE
                        <cfset count = 0>
                        <cfoutput query="serial">
                        <cfset count = count + 1>
                        <cfset model_no = #model_no#>
                        <cfset product_type = #product_type#>
                        <cfset type_hardware_failure = #type_hardware_failure#>
                        <cfset software_hardware = #software_hardware#>
                        <cfset resolution_verified_by = #resolution_verified_by#>
                        <cfset dept_responsibility = #dept_responsibility#>
                        
                        <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 ---> 
                        
                         <cfquery name="getnotes" dbtype="query" >
                        SELECT *
                        FROM notes
                        WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
                        cfsqltype="cf_sql_char" maxLength="20">
                        </cfquery>
                        <cfloop query="getnotes">
                        
                        <input type="hidden" name="pk_num_#count#" id="pk_num" value="" /></cfloop>
                        <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
                        scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
                        <tr><td id="paddingformutli">
                        Previously Submitted Descriptions:</td><td id="paddingformutli">
                        <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
                        <cfloop query="getnotes">
                        Added By: #fk_addedBy# <br/>
                        Dated Added: #DateFormat(date_stamp,'mm/dd/yyyy')#<br/><br/>
                        #description#
                        <div id="line"></div>
                        </cfloop></div></td>
                        
                        </tr>
                        </table>
                        <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
                        <tr>
                        <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
                        <td id="paddingformutli">
                        Description:&nbsp;&nbsp;
                        </td>
                        <td class="descriptionmoveinmulti">
                        
                        ( You may enter up to 1000 characters. )
                        <br>
                        <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
                        
                        </td>
                        </tr>
                        </table>
                        <!---Shows what was previously entered for Resolution ---> 
                        
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformutli">
                        Resolution:&nbsp;&nbsp;
                        </td>
                        <td class="resolutionmoveinmulti">
                        ( You may enter up to 1500 characters. )
                        <br>
                        <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
                        </td>
                        </tr>
                        </table>
                         
                        <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
                        
                        <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformultitop">
                        Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                        </td>
                        <td>
                        <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                        <input type="checkbox" name="currentdateresol_#count#" 
                        onClick="resdate_#count#.value=fill_date()">
                        </td>
                        <td>
                        Resolution Verified as effective by:&nbsp;&nbsp;
                        </td>
                        <td>
                        <select name="resvertified_#count#">
                        <option value="" selected>Make A Selection</option>
                        <cfloop query="gettech">
                        <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
                        selected</cfif>>#fname# #lname#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        </table>
                        <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformultitop">
                        Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                        </td>
                        <td class="vertificationmoveinmulti">
                        <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                        <input type="checkbox" name="currentdatevert_#count#" 
                        onClick="vertifidate_#count#.value=fill_date()">
                        
                        </td>
                        </tr>
                        </table>
                         
                        <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td class="red" id="paddingformultitop">
                        Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <select name="deptvendor_#count#">
                        <option value="" selected>Make A Selection</option>
                        <cfloop query="getDeptVendor">
                        <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
                        </cfloop>
                        </select>
                        </td>
                        </tr>
                        </table>
                        <input type="hidden" name="serialcount" id="serialcount" value="#count#">
                        
                        
                        
                        <!--- Adds Delete to every ticket  --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td>
                        <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
                        </td>
                        </tr>
                        <tr>
                        <td>
                        <input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamic#count#Input')">
                        </td>
                        </tr>
                        </table>
                        
                        
                        <!---Shows what was previously entered into parts table--->
                        <!---dbtype="query"--->
                        <cfquery name="getparts" dbtype="query" >
                        SELECT *
                        FROM parts
                        WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
                        cfsqltype="cf_sql_char" maxLength="20">
                        </cfquery>
                        <cfset count1 = 0>
                        <!---<cfif serial.recordcount is 0>--->
                        <cfloop query="getparts">
                        <cfset count1 = count1 + 1>
                        <div id="part#count1#Name#count#">
                        <!---<cfset partliststr = "">
                        <cfloop from="1" to="#count1#" index="pl">
                        <cfset partliststr = partliststr & #pl# & ",">
                        </cfloop>
                        
                        <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
                        <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
                        
                        <!---THIS IS THE PARTS SECTION--->
                        
                        <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
                        
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
                        <tr>
                        <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
                        <td>
                        Parts been returned*
                        <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
                        </td>
                        <td>
                        <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                        </td>
                        </tr>
                        </table>
                        <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
                        
                        
                        <!--- Shows what was previously entered for RMA Data Only  --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td id="paddingformultitop">
                        RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
                        </td>
                        <td class="rmanmoveinmulti">
                        ( You may enter up to 1000 characters. )
                        <br/>
                        <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea></td>
                        </tr>
                        </table>
                        
                        
                        <!--- Adds Delete to every ticket  --->
                        <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                        <tr>
                        <td>
                        <input type="button" class="removeticket" value="Remove Parts #count1#" 
                        onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
                        </td>
                        </td>
                        </tr>
                        </table>
                        </div>
                        <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
                        </cfloop>
                        </div>
                        <!---this one makes it so you can add a part to a previously submitted serial--->
                        <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
                        </cfoutput>
                        
                        <cfif serial.recordcount is 0>
                        <cfset model_no = "">
                        <cfset product_type = "">
                        <cfset type_hardware_failure = "">
                        <cfset pka_serialNo = "">
                        <cfset software_hardware = "">
                        <cfset description = "">
                        <cfset resolution = "">
                        <cfset resolution_date = "">
                        <cfset resolution_verified_by = "">
                        <cfset verification_date = "">
                        <cfset dept_responsibility = "">
                        <cfinclude template="serialpartsdisplay.cfm">
                        </cfif>
                        <input type="hidden" value="<cfoutput>#count#</cfoutput>" name="theValue" id="theValue" />
                        END OF MAIN DIV HERE
                        but what i am confused on is how would i do the parts? i got serial working but parts i don't. would i just start another cfif below the serial like i have below or how we had done it before ?
                        Code:
                        <cfoutput query="parts">
                        <cfset hc_partNo = #hc_partNo#>
                        <cfset part_returned = #part_returned#>
                        <cfset defective = #defective#>
                        <cfset rma_number = #rma_number#>
                        <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
                        </cfoutput>
                        <cfif parts.recordcount is 0>
                        <cfset hc_partNo = "">
                        <cfset part_returned = "">
                        <cfset defective = "">
                        <cfset rma_number = "">
                        <!---<cfinclude template="serialpartsdisplaytest.cfm">--->
                        </cfif>


                        Thank you,
                        Rach

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          The template should only contain the table for display. Things like setting of variables and counts, etc. should be in the main page, so that the template can be reused. This may seem like overkill now, but will save you a headache later when you have to change something.

                          For parts, yes, you could use a template if you're going to display an empty part table when there are no parts.

                          Comment

                          • bonneylake
                            Contributor
                            • Aug 2008
                            • 769

                            Hey Acoder,

                            Everything that i displayed in #401 (or above) is on the main page. Including the cfset. The only thing that is on the template is the following

                            Code:
                            <!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP--->
                            
                            <!--- Shows what was previously entered for Model No, Product Type, and Type of Hardware Failure  --->
                            <cfset count = 1>
                            <cfoutput>
                            <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 ---> 
                            
                             <cfquery name="getnotes" dbtype="query" >
                            SELECT *
                            FROM notes
                            WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
                            cfsqltype="cf_sql_char" maxLength="20">
                            </cfquery>
                            <cfloop query="getnotes">
                            
                            <input type="hidden" name="pk_num_#count#" id="pk_num" value="" /></cfloop>
                            <!---<div style="width: 150px; height: 150px; overflow-y: scroll; scrollbar-arrow-color:blue; 
                            scrollbar-face-color: #e7e7e7; scrollbar-3dlight-color: #a0a0a0; scrollbar-darkshadow-color:#888888;">--->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
                            <tr><td id="paddingformutli">
                            Previously Submitted Descriptions:</td><td id="paddingformutli">
                            <div id="descriptionbox" style="HEIGHT:100px; WIDTH:500px; OVERFLOW:auto;" >
                            <cfloop query="getnotes">
                            Added By: #fk_addedBy# <br/>
                            Dated Added: #DateFormat(date_stamp,'mm/dd/yyyy')#<br/><br/>
                            #description#
                            <div id="line"></div>
                            </cfloop></div></td>
                            
                            </tr>
                            </table>
                            <table class="zpExpandedTable" id="resoltable" cellpadding="3" cellspacing="0">
                            <tr>
                            <!---<input type="hidden" name="thedescriptoin_#count#" id="thedescriptoin" value="#description#" />--->
                            <td id="paddingformutli">
                            Description:&nbsp;&nbsp;
                            </td>
                            <td class="descriptionmoveinmulti">
                            
                            ( You may enter up to 1000 characters. )
                            <br>
                            <textarea maxlength='1000' onkeyup='return descriptionmaxlength(this)' onkeydown='return descriptionmaxlength(this)'rows='4' cols='60' name="thedescription_#count#"></textarea>
                            
                            </td>
                            </tr>
                            </table>
                            <!---Shows what was previously entered for Resolution ---> 
                            
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td id="paddingformutli">
                            Resolution:&nbsp;&nbsp;
                            </td>
                            <td class="resolutionmoveinmulti">
                            ( You may enter up to 1500 characters. )
                            <br>
                            <textarea  maxlength="1500" onkeyup="return resolutionismaxlength(this)" onkeydown="return resolutionismaxlength(this)" rows="4" cols="60" name="resolution_#count#">#resolution#</textarea>
                            </td>
                            </tr>
                            </table>
                             
                            <!--- Shows what was previously entered for Resolution Date, Current Date (for resolution date) and resolution vertified as effective by  --->
                            
                            <table class="zpExpandedTable" id="resoldatetab" cellpadding="1" cellspacing="0">
                            <tr>
                            <td id="paddingformultitop">
                            Resolution Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                            </td>
                            <td>
                            <input type="text" name="resdate_#count#" value="#DateFormat(resolution_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                            <input type="checkbox" name="currentdateresol_#count#" 
                            onClick="resdate_#count#.value=fill_date()">
                            </td>
                            <td>
                            Resolution Verified as effective by:&nbsp;&nbsp;
                            </td>
                            <td>
                            <select name="resvertified_#count#">
                            <option value="" selected>Make A Selection</option>
                            <cfloop query="gettech">
                            <option value="#fname# #lname#"<cfif "#fname# #lname#" is #resolution_verified_by#>
                            selected</cfif>>#fname# #lname#</option>
                            </cfloop>
                            </select>
                            </td>
                            </tr>
                            </table>
                            <!--- Shows what was previously entered for Vertification Date, Current Date (for vertification date)   --->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td id="paddingformultitop">
                            Verification Date:&nbsp;(MM/DD/YYYY)&nbsp;&nbsp;
                            </td>
                            <td class="vertificationmoveinmulti">
                            <input type="text" name="vertifidate_#count#" value="#DateFormat(verification_date,'mm/dd/yyyy')#">&nbsp;&nbsp;
                            &nbsp;&nbsp;&nbsp;&nbsp;Current Date:&nbsp;&nbsp;
                            <input type="checkbox" name="currentdatevert_#count#" 
                            onClick="vertifidate_#count#.value=fill_date()">
                            
                            </td>
                            </tr>
                            </table>
                             
                            <!--- Shows what was previously entered for Dept/Vendor Responsibility  --->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td class="red" id="paddingformultitop">
                            Dept/Vendor Responsibility*:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <select name="deptvendor_#count#">
                            <option value="" selected>Make A Selection</option>
                            <cfloop query="getDeptVendor">
                            <option value="#pk_deptVendor#"<cfif #pk_deptVendor# is #dept_responsibility#>selected</cfif>>#pk_deptVendor#</option>
                            </cfloop>
                            </select>
                            </td>
                            </tr>
                            </table>
                            <input type="hidden" name="serialcount" id="serialcount" value="#count#">
                            
                            
                            
                            <!--- Adds Delete to every ticket  --->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td>
                            <input type="button" class="removeticket" value="Remove Serial #count#" onClick="removeElement('dynamic#count#Input')">
                            </td>
                            </tr>
                            <tr>
                            <td>
                            <input type="button" class="addticket" value="Add Parts" onClick="addpartInput('dynamic#count#Input')">
                            </td>
                            </tr>
                            </table>
                            
                            
                            <!---Shows what was previously entered into parts table--->
                            <!---dbtype="query"--->
                            <cfquery name="getparts" dbtype="query" >
                            SELECT *
                            FROM parts
                            WHERE fk_serialNo=<cfqueryparam value="#pka_serialNo#" 
                            cfsqltype="cf_sql_char" maxLength="20">
                            </cfquery>
                            <cfset count1 = 0>
                            <!---<cfif serial.recordcount is 0>--->
                            <cfloop query="getparts">
                            <cfset count1 = count1 + 1>
                            <div id="part#count1#Name#count#">
                            <!---<cfset partliststr = "">
                            <cfloop from="1" to="#count1#" index="pl">
                            <cfset partliststr = partliststr & #pl# & ",">
                            </cfloop>
                            
                            <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
                            <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
                            
                            <!---THIS IS THE PARTS SECTION--->
                            
                            <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
                            
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
                            <tr>
                            <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
                            <td>
                            Parts been returned*
                            <input type="checkbox" name="partsreturn_#count1#_#count#" value="#part_returned#"<cfif #part_returned# eq "1">checked=yes</cfif>/>
                            </td>
                            <td>
                            <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                            </td>
                            </tr>
                            </table>
                            <!---<input type="hidden" name="partscount#count#" id="partscount#count#" value="#count#">--->
                            
                            
                            <!--- Shows what was previously entered for RMA Data Only  --->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td id="paddingformultitop">
                            RMA Data Only:&nbsp;&nbsp;&nbsp;&nbsp;
                            </td>
                            <td class="rmanmoveinmulti">
                            ( You may enter up to 1000 characters. )
                            <br/>
                            <textarea maxlength="1000" onkeyup="return rmaismaxlength(this)" onkeydown="return rmaismaxlength(this)" rows="4" cols="60" name="rma_#count1#_#count#" >#rma_number#</textarea></td>
                            </tr>
                            </table>
                            
                            
                            <!--- Adds Delete to every ticket  --->
                            <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                            <tr>
                            <td>
                            <input type="button" class="removeticket" value="Remove Parts #count1#" 
                            onclick="removetheElement('part#count1#Name#count#',#count#,#count#)"></a>
                            </td>
                            </td>
                            </tr>
                            </table>
                            </div>
                            <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
                            </cfloop>
                            </div>
                            <!---this one makes it so you can add a part to a previously submitted serial--->
                            <input type="hidden" name="partcounter#count#" id="partcounter#count#" value="#count1#" />
                            </cfoutput>


                            but with the parts, your saying to create another template for it right? i tried already to make a separate template for just parts an i ran into lots of trouble with it, it wouldn't count right, it wouldn't show up at some points, an sometimes i couldn't add parts. Is there a way i could use the same template since parts is already inbetween on the serialpartsdisp lay.cfm template?

                            Thank you,
                            Rach

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              OK, I actually meant the div "dynamic#count# input" and all its contents should be in the template. The rest should be outside.

                              You have the serials working with the template, so we can work on that first and worry about parts later.

                              Comment

                              • bonneylake
                                Contributor
                                • Aug 2008
                                • 769

                                Hey Acoder,

                                Your saying to take the dynamiccount, put it in the template an then what about the main page? do i need to take dynamiccount and everything between it out of the main page?

                                Thank you,
                                Rach

                                Comment

                                Working...