displaying previously entered multiple fields

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

    Hey Acoder,

    I havent gotten any further on the checkboxes. The only thing i know is when i insert for the first time a part if i have it as checked or yes i have no problem changing the checkbox from yes to no back to yes. But if i submit it as no i can not get it to go back to yes. i also have figured this out with another field, in one section if i go back to cticketpage1edi t.cfm if i submitted htpp as no to begin with if i try to change it to yes an submit it it wont do it, it wont even submit.but i am doing them all the same which is like so

    Code:
    <input type="checkbox" name="defective_#count1#_#count#" 
    value="#defective#"<cfif #defective# eq "1">checked=yes</cfif> /
    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      Check the database. Is it deleted from the database?
      Re. checkboxes: Try something like:
      Code:
      <input type="checkbox" name="partsreturn_#count1#_#count#" value="1"
      <cfif Val(part_returned) eq 1>checked</cfif>/>

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        Hey Acoder,

        Yes parts is being delete from the table. An that worked perfectly for the checkbox.

        I don't know if this would help but this is what my print ticket looks like

        Code:
         <CFLOOP list="#form.serialcount#" index="machineCount">
         <CFSET serialnum       = "Form.serialnum_" & machineCount>
         <CFSET modelno         = "Form.modelno_" & machineCount>
         <CFSET producttype     = "Form.producttype_" & machineCount>
         <CFSET softhardware    = "Form.softhardware_" & machineCount>
         <CFSET resolution      = "Form.resolution_" & machineCount>
         <CFSET resdate         = "Form.resdate_" & machineCount>
         <CFSET resvertified    = "Form.resvertified_" & machineCount>
         <CFSET vertifidate     = "Form.vertifidate_" & machineCount>
         <CFSET deptvendor      = "Form.deptvendor_" & machinecount>
         <CFSET hardwarefailure = "Form.hardwarefailure_" & machineCount>
         <CFSET thedescription  = "Form.thedescription_" & machineCount>
         <fieldset> 
        <legend>Serial information #machinecount#</legend>  
        <ol>
        <li>
        <label for="model no">Model No:</label>
        #evaluate(modelno)#<br/>
        </li>
        <li>
        <label for="product type">Product Type:</label>
        #evaluate(producttype)#<br/>
        </li>  
        <li>
        <label for="type of hardware failure">Type of Hardware Failure:</label>
        #evaluate(hardwarefailure)#<br/>
        </li>
        <li>  <label for="serial number">Serial Number:</label>
        #evaluate(serialnum)#<br/>
        </li>
        <li>
        <label for="software/hardware">Software/Hardware:</label>
        #evaluate(softhardware)#<br/>
        </li>
        <li>
        <label for="description">Description:</label>
        #evaluate(thedescription)#<br/>
        </li>
        <li>
        <label for="resolution">Resolution:</label>
        #evaluate(resolution)#<br/>
        </li>
        <li>
        <label for="resolution date">Resolution Date:</label>
        #evaluate(resdate)#<br/>
        </li>
        <li>
        <label for="resolution verified as effective by">Resolution Verified as effective by:</label>
        #evaluate(resvertified)#<br/>
        </li>
        <li>
        <label for="verification date">Verification Date:</label>
        #evaluate(vertifidate)#<br/>
        </li>
        <li>
        <label for="dept./vendor responsibility">Dept./Vendor Responsibility:</label>
        #evaluate(deptvendor)#<br/>
        </li>
         </ol>
         </fieldset>
        
        <cfloop list="#form['partscount' & machinecount]#" index="ps">
         <CFSET pkpartID        = Form["pkpartID_" & "#ps#" & "_#machinecount#"]>
         <CFSET hcpn            = Form["hcpn_" & "#ps#" & "_#machinecount#"]>
         <CFSET partsreturn     = Form["partsreturn_" & "#ps#" & "_#machinecount#"]>
         <CFSET defective       = Form["defective_" & "#ps#" & "_#machinecount#"]>
          <CFSET rma             = Form["rma_" & "#ps#" & "_#machineCount#"]>
        <cfif hcpn neq "">
        <fieldset> 
        <legend>Parts information #ps# Serial information #machinecount#</legend>  
        <ol>  
        <li>  <label for="HC P/N">HC P/N:</label>
        #hcpn#<br/>
        </li>
        <li>
        
        <label for="have all parts been returned">Parts been returned:</label>
        <cfswitch expression="#evaluate(partsreturn)#">
        <cfcase value="0" delimiters=",">
        No
        </cfcase>
        <cfcase value="1" delimiters=",">
        Yes
        </cfcase>
        </cfswitch>
        <br/>
        </li>
        <li>
        <label for="defective">Defective:</label>
        <cfswitch expression="#evaluate(defective)#">
        <cfcase value="0" delimiters=",">
        No
        </cfcase>
        <cfcase value="1" delimiters=",">
        Yes
        </cfcase>
        </cfswitch><br/>
        </li>
        <li>
        <label for="rma data only">RMA Data Only:</label>
        #rma#<br/>
        </li>
         </ol>
         </fieldset>
        <cfelse>
         </cfif>
          </CFLOOP>
         </cfloop>
         </cfoutput>
        Thank you :),
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          If it's after submission, you don't need to use the form fields. You can use the database to show the current data.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            Hey Acoder,

            I am confused by what you mean. Even if i take the form fields out like below i am still getting the same results

            Code:
            <cfloop list="#form['partscount' & machinecount]#" index="ps">
            <fieldset> 
            <legend>Parts information #ps# Serial information #machinecount#</legend>  
            <ol>  
            <li>  <label for="HC P/N">HC P/N:</label>
            #hcpn#<br/>
            </li>
            <li>
            
            <label for="have all parts been returned">Parts been returned:</label>
            <cfswitch expression="#evaluate(partsreturn)#">
            <cfcase value="0" delimiters=",">
            No
            </cfcase>
            <cfcase value="1" delimiters=",">
            Yes
            </cfcase>
            </cfswitch>
            <br/>
            </li>
            <li>
            <label for="defective">Defective:</label>
            <cfswitch expression="#evaluate(defective)#">
            <cfcase value="0" delimiters=",">
            No
            </cfcase>
            <cfcase value="1" delimiters=",">
            Yes
            </cfcase>
            </cfswitch><br/>
            </li>
            <li>
            <label for="rma data only">RMA Data Only:</label>
            #rma#<br/>
            </li>
             </ol>
             </fieldset>
              </CFLOOP>
             </cfloop>
             </cfoutput>
            i also tried to just cfloop query="parts" around the whole section an that seemed to cause the same effect.

            Thank you,
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              By that, I meant a new query and loop over the results.

              You may be able to work with the form fields too, but it'd require adding all of that code that you used earlier for adding/updating/deleting to display the correct current information.

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                Hey Acoder,

                I think i know what the problem is an i could cry. I forgot in my serialpartsdisp lay.cfm i did this.
                Code:
                <cfset count1 = 0>
                <cfloop query="getparts">
                <cfset count1 = count1 + 1>
                <cfset hc_partNo = #hc_partNo#>
                <cfset part_returned = #part_returned#>
                <cfset defective = #defective#>
                <cfset rma_number = #rma_number#>
                <cfinclude template="partsdisplay.cfm">
                   </cfloop>
                
                <cfif serial.recordcount is 0 and getparts.recordcount is 0>
                 <cfset count1 = 1>
                <cfset hc_partNo = "">
                <cfset part_returned = "">
                <cfset defective = ""> 
                <cfset rma_number = "">
                <cfinclude template="partstest.cfm">
                 </cfif>
                basically partstest.cfm is a copy of partsdisplay.cf m without the hidden line for pkpartID. An well i tried to change it back to partsdisplay.cf m but now it wont work (again). It will work if have parts, but if don't have parts i get an error an its an administrator error. If i comment out pkpartID the part will appear when no serial are filled out, however if pkpartID is not commented out it gives an error.Is there anyway to have pk_partID in partsdisplay.cf m an not in partsdisplay.cf m at the same time? here is what i got on partsdisplay.cf m. here is what i got on

                partsdisplay.cf m

                Code:
                <cfoutput>
                <div id="part#count1#Name#count#">
                
                
                <input type="hidden" name="pkpartID_#count1#_#count#" id="pkpartID" value="#pk_partID#" />
                
                <!---<cfset partliststr = "">
                <cfloop from="1" to="#count1#" index="pl">
                <cfset partliststr = partliststr & #pl# & ",">
                </cfloop>
                
                <input type="hidden" name="part2count#count#" id="part2count#count#" value="#partliststr#">
                <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#">--->
                
                <!---THIS IS THE PARTS SECTION--->
                
                
                
                <table class="zpExpandedTable" id="resoltable" cellpadding="1" cellspacing="0">
                <th class="sectiontitle" colspan="7">Parts Information #count1# Serial Information #count#</th>
                <tr>
                <td class='indent' id='formfieldpadding'>HC P/N:&nbsp;&nbsp;&nbsp;<input type='text' name="hcpn_#count1#_#count#" style="margin:0px" value="#hc_partNo#"></td>
                <td>
                Parts been returned
                <input type="checkbox" name="partsreturn_#count1#_#count#" value="1"<cfif Val(part_returned) eq 1>checked</cfif>/>
                </td>
                <td>
                <td class="indent">Defective<input type="checkbox" name="defective_#count1#_#count#" 
                value="1"<cfif Val(defective) eq 1>checked</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#)">
                </td>
                </td>
                </tr>
                </table>
                
                
                </div>
                <input type="hidden" name="partscount#count#" id="partscount#count#" value="#count1#"/>
                </cfoutput>


                Thank you,
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  You need to add
                  Code:
                  <cfset pk_partID = "">
                  but I have a question. If a part is empty, it won't have a part ID, so how is that dealt with. I could look back at your previous posts/code, but trying to sieve through all that code would be a bit of a mission!

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    Hey Acoder,

                    That worked perfectly!!! but i am going to do some more tests after lunch an DOUBLE check to make sure.An i don't blame you one bit for not wanting to look back at the post lol

                    But ok here is how it is working. If a part ID exists, it will update. However, if a part ID does not exist it will insert a new record. So basically if you took firebug an looked at it (at a previous part) you would see with each part it has a part id associated, but if you add a part no part id associated. However, if you submitted that part with no part id, if you went back an looked at cticketpage2edi t.cfm an used firebug you would see it got assigned a part id after submission.

                    but thank you so much for the help, all come back after i do more tests an let you know if this thread can finally be put to rest. But thank you again for all the help!!!

                    Thank you :),
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      Well, a small fix in the end as it is the case with a lot of problems. Hopefully that's the last of them :)

                      It does make sense how you're using the part ID.

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        Hey Acoder,

                        I do got one last problem. For some reason i can insert attachments fine. But when i go to cticketpage2edi t.cfm an try to add more attachments it wont let me download them on to the table. So i was wondering could what we did to serials and parts mess with it?

                        Thank you
                        Rach

                        Comment

                        • bonneylake
                          Contributor
                          • Aug 2008
                          • 769

                          Hey Acoder,

                          I figured out attachments, i needed to change one word in it. But i also realized that to download a file you need a serial, is there anyway to put like a blank entry in the serial section of attachments so that they could still upload attachments? here is what i am using for attachments now

                          Code:
                          <!---Inserts attachments into attachments.--->
                                <cfif structKeyExists(FORM, "uploads")>
                                     <cfset currentDirectory = GetDirectoryFromPath(GetTemplatePath()) & "uploaded">
                                     <cfparam name="FORM.uploads" default="">
                                     <cfloop list="#form.uploads#" index="counter">
                                      <cfset currentDescription = form["description" & counter]>
                                <!---      verify the form field exists --->
                                     <cfif structKeyExists(FORM, "attachment"& counter)>
                                     <!---      try and upload it ...--->
                                          <cftry>
                                     <cfif Len(FORM["attachment#counter#"])>
                                          <cffile action="upload" fileField="form.attachment#counter#" destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\" nameconflict="MAKEUNIQUE">
                                          <cfset filename = cffile.ClientFileName & "_" & form.pk_ticketID & "_" & counter & "." & cffile.ClientFileExt>
                            <!---  IF RUN INTO PROBLEMS WITH FILES NOT GOING INTO TABLE MAKE SURE EVERYTHING BETWEEN SOURCE="" IS ALL ON ONE LINE--->
                               <CFFILE ACTION="RENAME" SOURCE="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#CFFILE.ServerFile#" 
                               destination="C:\Inetpub\Development\WWWRoot\RachelB\footprints\form\attachments\#filename#">
                                              <cfquery name="attachment" datasource="CustomerSupport">
                                    exec usp_CS_UpdateInsertattachments
                                '#Form.pk_ticketID#','#serialnum#','#currentDescription#','#filename#','#Form.fk_addedBy#'
                                </cfquery>
                                        </cfif>
                                          <cfcatch><!--- do something here, e.g. display error message.. --->
                                     </cfcatch>
                                     </cftry>
                                     </cfif>
                                     </cfloop>
                                </cfif>
                          but besides that serials and parts are working perfectly :).

                          Thank you again for all the help :),
                          Rach

                          Comment

                          • acoder
                            Recognized Expert MVP
                            • Nov 2006
                            • 16032

                            I'm not sure I quite understand what you mean here:
                            Originally posted by bonneylake
                            But i also realized that to download a file you need a serial, is there anyway to put like a blank entry in the serial section of attachments so that they could still upload attachments?
                            So you want users to be able to upload attachments without depending on serials?

                            Comment

                            • bonneylake
                              Contributor
                              • Aug 2008
                              • 769

                              Hey Acoder,

                              Yes that is correct. Right now they can submit contact information without a serial or part. But if you try to upload an attachment it wont let you put it in the database without a serialnum.

                              Thank you,
                              Rach

                              Comment

                              • acoder
                                Recognized Expert MVP
                                • Nov 2006
                                • 16032

                                The problem is that attachments are linked/attached to a serial. Change the database to only link attachments to the ticket by removing serial number and then change your Coldfusion code accordingly.

                                Comment

                                Working...