URL Method for 3 tables?

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

    #46
    Originally posted by acoder
    No, the cfif must be outside the cfoutput query unless this is copied code and the previous code is untouched in which case you need to remove all code which references the query and its fields because there are no records.

    One possibility that might make sense here is to have one file which contains the table and you set the variables before you call the file. This would avoid this repetition in the code which feels wrong and looks ugly.

    Note that Coldfusion generates the JavaScript, so you can't move that into its own file unless it's a Coldfusion file rather than a JavaScript one.
    Hey Acoder,

    Yes the previous code has been untouched (just copied everything from the previous into the cfif. But i got it to display with nothing applied to it. But i must admit i am now having the trouble i had with serial with my parts table. i thought solving serial would solve parts but didn't an having trouble with it (exact same trouble with displaying it with no value applied).

    an since i am having the same trouble with parts like serial and i would really hate to have 2 sections of code repeated twice to do this so i was wondering how would i go about making the file which contains the table and set s the variables before calling the file?

    but yeah i figured i couldn't move the javascript based on the fact that it uses html and coldfusion. I moved other parts of the form into there own table but was only able to do those because didn't need anything from the html or coldfusion.

    Thank you,
    Rach

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #47
      If the parts and serials tables are significantly different, you're going to have to create two files anyway. Set all the values before including the file (which you're doing now anyway) and set them to empty for the 0 recordcount part, e.g.
      Code:
      <cfoutput query="serial">
      <!--- cfset statements --->
      <cfinclude ...>
      </cfoutput>
      <cfif serial.recordcount is 0>
      <!--- cfset statements similar to above but set to "" --->
      <cfinclude ...>
      </cfif>

      Comment

      • bonneylake
        Contributor
        • Aug 2008
        • 769

        #48
        Hey Acoder,

        Ok well here is what i got. But i got one question, was i suppose to use the value i assigned to each field or use the field name? i used the value i gave each field for this because was not sure.

        Code:
        serial table
        <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#>
        <cfset description = #description#>
        <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#>
        <cfset rma_data = #rma_data#>
        <cfinclude template="serialdisplay.cfm">
        </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 = "">
        <cfset rma_data = "">
        </cfinclude>
        </cfif>
        
        parts table
        <cfoutput query="parts">
        <cfset hc_partNo = #hc_partNo#>
        <cfset defective = #defective#>
        <cfset submission = #submission#>
        <cfinclude template="partsdisplay.cfm">
        </cfoutput>
        <cfif parts.recordcount is 0>
        <cfset hc_partNo = "">
        <cfset defective = "">
        <cfset submission = "">
        </cfinclude>
        </cfif>
        Thank you,
        Rach

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #49
          The cfinclude should be the same for when the record count is 0, not </cfinclude>

          If the field names are the same, you can remove those declarations from inside the loop.

          A thought occurred to me. Could you not have empty serial/part tables/fields regardless of whether there was 0 record count or not, i.e. an empty table always appears at the end? This would get rid of the need to check for 0 record count.

          Comment

          • bonneylake
            Contributor
            • Aug 2008
            • 769

            #50
            Hey Acoder,

            well it doesn't always need a empty table at the end. Most of the time all of the fields should be filled in except a few. those few not filled in are the ones the person filling in the information has to wait on till the user there helping has there problem solved.But although i know most of the fields should be filled in, that might not always be the case which is why i am making sure all the fields can allow blanks in them. An i am afraid adding a table at the end of it all would confuse the users an they would think to delete it every time an we got some lazy people who would complain about having to do that.but here is what i got, whats the next step?

            Code:
            serial table
            <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#>
            <cfset description = #description#>
            <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#>
            <cfset rma_data = #rma_data#>
            <cfinclude template="serialdisplay.cfm">
            </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 = "">
            <cfset rma_data = "">
            <cfinclude>
            </cfif>
            
            
            parts table
            <cfoutput query="parts">
            <cfset hc_partNo = #hc_partNo#>
            <cfset defective = #defective#>
            <cfset submission = #submission#>
            <cfinclude template="partsdisplay.cfm">
            </cfoutput>
            <cfif parts.recordcount is 0>
            <cfset hc_partNo = "">
            <cfset defective = "">
            <cfset submission = "">
            <cfinclude>
            </cfif>
            Thank you :),
            Rach

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #51
              I meant the exact same call, i.e.
              Code:
              <cfinclude template="serialdisplay.cfm">

              Comment

              • bonneylake
                Contributor
                • Aug 2008
                • 769

                #52
                Originally posted by acoder
                I meant the exact same call, i.e.
                Code:
                <cfinclude template="serialdisplay.cfm">
                Hey Acoder,

                i am lost by what you mean. do you mean copy what i have above into the serialdisplay.c fm?

                Thank you,
                Rach

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #53
                  I mean here:
                  Code:
                  <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 = "">
                  <cfset rma_data = "">
                  [b]<cfinclude template="serialdisplay.cfm">[/b]
                  </cfif>

                  Comment

                  • bonneylake
                    Contributor
                    • Aug 2008
                    • 769

                    #54
                    Hey Acoder,

                    ok here is what i got.what needs to happen next?

                    Code:
                    <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#>
                    <cfset description = #description#>
                    <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#>
                    <cfset rma_data = #rma_data#>
                    </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 = "">
                    <cfset rma_data = "">
                    <cfinclude template="serialdisplay.cfm">
                    </cfif>
                    
                    <cfoutput query="parts">
                    <cfset hc_partNo = #hc_partNo#>
                    <cfset defective = #defective#>
                    <cfset submission = #submission#>
                    </cfoutput>
                    <cfif parts.recordcount is 0>
                    <cfset hc_partNo = "">
                    <cfset defective = "">
                    <cfset submission = "">
                    <cfinclude template="partsdisplay.cfm">
                    </cfif>
                    Thank you,
                    Rach

                    Comment

                    • acoder
                      Recognized Expert MVP
                      • Nov 2006
                      • 16032

                      #55
                      Well, does it work? What happens?

                      Comment

                      • bonneylake
                        Contributor
                        • Aug 2008
                        • 769

                        #56
                        Originally posted by acoder
                        Well, does it work? What happens?
                        Hey Acoder,

                        Well when i try it, it says that theres nothing in the template. Am i suppose to make a copy of what i have now an put it in the template?

                        Thank you,
                        Rach

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #57
                          Yes, put the div "dynamic#count# Input" code in the include template.

                          Comment

                          • bonneylake
                            Contributor
                            • Aug 2008
                            • 769

                            #58
                            Originally posted by acoder
                            Yes, put the div "dynamic#count# Input" code in the include template.
                            Hey Acoder,

                            The serial part works correctly (yay). But i can't get the parts page to. The parts uses 2 tables for it to display. The thing is everything from the first (ticket) table displays correctly, but everything in the parts table won't display correctly. I don't know if i need to combine them or really do what but it still wont display right. Here is what i have

                            here is what i have for the original parts table
                            Code:
                            <!--- Parts Information --->
                            <cfoutput query="parts">
                            <table class="createticketables" id="spaceup" >
                            <th class="sectiontitle" colspan="7">Parts Information</th>
                            <tr>
                            <td class="indent" id="formfieldpadding">HC P/N:&nbsp;&nbsp;&nbsp;<input type="text" name="hcpn" style="margin:0px" value="#hc_partNo#"></td>
                            <td class="red">
                            Have all parts been returned*
                            <cfset part_returned = #part_returned#>
                            <select name="partsreturn" id="partsreturn">
                            <option value="" selected>Make A Selection</option>
                            <option value="N/A"<cfif #part_returned# is "N/A">selected</cfif>>N/A</option>
                            <option value="No"<cfif #part_returned# is "No">selected</cfif>>No</option>
                            <option value="Yes"<cfif #part_returned# is "Yes">selected</cfif>>Yes</option>
                            </select>
                            </td>
                            <td>
                            <td class="indent">Defective<input type="checkbox" name="defective" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                            </td>
                            </tr>
                            </table>
                            <table class="createticketables" >
                            <tr>
                            </cfoutput>
                            <cfoutput query="ticket">
                            <td class="indent"  id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;<input type="text" name="followdate" value="#followup_date#" size="8"/>&nbsp;&nbsp;&nbsp;Current Date<input type="checkbox" name="followcheck" value="" onClick="followdate.value=fill_date()"/></td>
                            <td>On Site:</td><td>
                            <select name="onsite" id="onsite">
                            <option value="" selected>No Choice</option>
                              <option value="Yes"<cfif #onsite_flag# is "Y">selected</cfif>>Yes</option>
                              <option value="No"<cfif #onsite_flag# is "N">selected</cfif>>No</option>
                            </select>
                            <td>
                            <td>Number of Onsite:</td><td>
                            <select name="numonsite">
                            <option value="" selected>No Choice</option>
                              <cfloop from="0" to="10" index="nonsite"><option value="#nonsite#"<cfif #number_onsite# is #nonsite#>selected</cfif>>#nonsite#</option></cfloop>
                            </select></cfoutput><td>
                            </tr>
                            </table>
                            <table class="createticketables" id="space">
                            <tr>
                            <td class="indent" id="formfieldpadding">Submission:
                            <cfoutput query="parts">
                            <select class="submissionticketbox" name="submission">
                            <option value="" selected>Make a Selection</option>
                              <option value="Phone"<cfif #submission# is "Phone">selected</cfif>>Phone</option>
                              <option value="Techmail"<cfif #submission# is "Techmail">selected</cfif>>Techmail</option>
                              <option value="Request"<cfif #submission# is "Request">selected</cfif>>Request</option>
                            </select>
                            </cfoutput>
                            </td>
                            </tr>
                            </table>
                            <cfoutput query="parts">
                            <cfset hc_partNo = #hc_partNo#>
                            <cfset defective = #defective#>
                            <cfset submission = #submission#>
                            </cfoutput>
                            <cfif parts.recordcount is 0>
                            <cfset hc_partNo = "">
                            <cfset defective = "">
                            <cfset submission = "">
                            <cfinclude template="partsdisplay.cfm">
                            </cfif>
                            and here is what i have on the parts template

                            Code:
                            <cfoutput query="parts">
                            <table class="createticketables" id="spaceup" >
                            <th class="sectiontitle" colspan="7">Parts Information</th>
                            <tr>
                            <td class="indent" id="formfieldpadding">HC P/N:&nbsp;&nbsp;&nbsp;<input type="text" name="hcpn" style="margin:0px" value="#hc_partNo#"></td>
                            <td class="red">
                            Have all parts been returned*
                            <cfset part_returned = #part_returned#>
                            <select name="partsreturn" id="partsreturn">
                            <option value="" selected>Make A Selection</option>
                            <option value="N/A"<cfif #part_returned# is "N/A">selected</cfif>>N/A</option>
                            <option value="No"<cfif #part_returned# is "No">selected</cfif>>No</option>
                            <option value="Yes"<cfif #part_returned# is "Yes">selected</cfif>>Yes</option>
                            </select>
                            </td>
                            <td>
                            <td class="indent">Defective<input type="checkbox" name="defective" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                            </td>
                            </tr>
                            </table>
                            <table class="createticketables" >
                            <tr>
                            </cfoutput>
                            <cfoutput query="parts">
                            <select class="submissionticketbox" name="submission">
                            <option value="" selected>Make a Selection</option>
                              <option value="Phone"<cfif #submission# is "Phone">selected</cfif>>Phone</option>
                              <option value="Techmail"<cfif #submission# is "Techmail">selected</cfif>>Techmail</option>
                              <option value="Request"<cfif #submission# is "Request">selected</cfif>>Request</option>
                            </select>
                            </cfoutput>
                            Thank you,
                            Rach

                            Comment

                            • acoder
                              Recognized Expert MVP
                              • Nov 2006
                              • 16032

                              #59
                              Was the parts part working before because it does look a bit of a mess with a mixture of cfoutputs?

                              What you should have is something similar in shape to the serials, i.e. cfset settings before the calls to cfinclude in the main file. In partsdisplay.cf m, show the table(s), but remove any cfset settings in the code (otherwise they will override what you've set in the parent file).

                              Comment

                              • bonneylake
                                Contributor
                                • Aug 2008
                                • 769

                                #60
                                Hey Acoder,

                                For some reason i just got that part working (almost). The problem i am having now is that everything from the other table is not displaying in the entire table. Like the 3 from the ticket table is just floating around while the other 4 fields is in a table and looking nice. i tried to copy all the fields from the original file to the partsdisplay.cf m but when i do that it makes those 3 other fields appear twice. any ideas?

                                appears in partsdisplay.cf m
                                Code:
                                <!---IF HAVE ANY BLANKS IN ANY FIELDS THIS MAKES IT SO THE FIELD WILL SHOW UP--->
                                
                                <cfif parts.recordcount is 0>  
                                <cfoutput>
                                <table class="createticketables" id="spaceup" >
                                <th class="sectiontitle" colspan="7">Parts Information</th>
                                <tr>
                                <td class="indent" id="formfieldpadding">HC P/N:&nbsp;&nbsp;&nbsp;<input type="text" name="hcpn" style="margin:0px" value="#hc_partNo#"></td>
                                <td class="red">
                                Have all parts been returned*
                                <select name="partsreturn" id="partsreturn">
                                <option value="" selected>Make A Selection</option>
                                <option value="N/A"<cfif #part_returned# is "N/A">selected</cfif>>N/A</option>
                                <option value="No"<cfif #part_returned# is "No">selected</cfif>>No</option>
                                <option value="Yes"<cfif #part_returned# is "Yes">selected</cfif>>Yes</option>
                                </select>
                                </td>
                                <td>
                                <td class="indent">Defective<input type="checkbox" name="defective" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                                </td>
                                </tr>
                                </table>
                                <table class="createticketables" id="space">
                                <tr>
                                <td class="indent" id="formfieldpadding">Submission:
                                <select class="submissionticketbox" name="submission">
                                <option value="" selected>Make a Selection</option>
                                  <option value="Phone"<cfif #submission# is "Phone">selected</cfif>>Phone</option>
                                  <option value="Techmail"<cfif #submission# is "Techmail">selected</cfif>>Techmail</option>
                                  <option value="Request"<cfif #submission# is "Request">selected</cfif>>Request</option>
                                </select>
                                </td>
                                </tr>
                                </table>
                                </cfoutput>
                                </cfif>
                                appears in original form
                                Code:
                                <!--- Parts Information --->
                                <cfoutput query="parts">
                                <table class="createticketables" id="spaceup" >
                                <th class="sectiontitle" colspan="7">Parts Information</th>
                                <tr>
                                <td class="indent" id="formfieldpadding">HC P/N:&nbsp;&nbsp;&nbsp;<input type="text" name="hcpn" style="margin:0px" value="#hc_partNo#"></td>
                                <td class="red">
                                Have all parts been returned*
                                <cfset part_returned = #part_returned#>
                                <select name="partsreturn" id="partsreturn">
                                <option value="" selected>Make A Selection</option>
                                <option value="N/A"<cfif #part_returned# is "N/A">selected</cfif>>N/A</option>
                                <option value="No"<cfif #part_returned# is "No">selected</cfif>>No</option>
                                <option value="Yes"<cfif #part_returned# is "Yes">selected</cfif>>Yes</option>
                                </select>
                                </td>
                                <td>
                                <td class="indent">Defective<input type="checkbox" name="defective" value="#defective#"<cfif #defective# eq "1">checked=yes</cfif>/></td>
                                </tr>
                                </table>
                                </cfoutput>
                                <cfoutput query="ticket">
                                <table class="createticketables" >
                                <tr>
                                <td class="indent"  id="formfieldpadding">Follow up Date:(MM/DD/YYYY)&nbsp;&nbsp;&nbsp;<input type="text" name="followdate" value="#followup_date#" size="8"/>&nbsp;&nbsp;&nbsp;Current Date<input type="checkbox" name="followcheck" value="" onClick="followdate.value=fill_date()"/></td>
                                <td>On Site:</td>
                                <td>
                                <select name="onsite" id="onsite">
                                <option value="" selected>No Choice</option>
                                  <option value="Yes"<cfif #onsite_flag# is "Y">selected</cfif>>Yes</option>
                                  <option value="No"<cfif #onsite_flag# is "N">selected</cfif>>No</option>
                                </select>
                                </td>
                                <td>Number of Onsite:</td>
                                <td>
                                <select name="numonsite">
                                <option value="" selected>No Choice</option>
                                <cfloop from="0" to="10" index="nonsite">
                                <option value="#nonsite#"<cfif #number_onsite# is #nonsite#>selected</cfif>>#nonsite#
                                </option></cfloop>
                                </select>
                                </td>
                                </tr>
                                </table>
                                </cfoutput>
                                <cfoutput query="parts">
                                <table class="createticketables" id="space">
                                <tr>
                                <td class="indent" id="formfieldpadding">Submission:
                                <select class="submissionticketbox" name="submission">
                                <option value="" selected>Make a Selection</option>
                                  <option value="Phone"<cfif #submission# is "Phone">selected</cfif>>Phone</option>
                                  <option value="Techmail"<cfif #submission# is "Techmail">selected</cfif>>Techmail</option>
                                  <option value="Request"<cfif #submission# is "Request">selected</cfif>>Request</option>
                                </select>
                                </td>
                                </tr>
                                </table>
                                </cfoutput>
                                
                                <cfoutput query="parts">
                                <cfset hc_partNo = #hc_partNo#>
                                <cfset part_returned = #part_returned#>
                                <cfset defective = #defective#>
                                <cfset submission = #submission#>
                                </cfoutput>
                                <cfif parts.recordcount is 0>
                                <cfset hc_partNo = "">
                                <cfset part_returned = "">
                                <cfset defective = "">
                                <cfset submission = "">
                                <cfinclude template="partsdisplay.cfm">
                                </cfif>
                                Thank you,
                                Rach

                                Comment

                                Working...