9 Replies Latest reply on May 19, 2006 11:38 AM by wilsonil

    Setting Unique Values

    wilsonil Level 1
      I posted a message earlier about updating muliptle rows on one page. I was told to try using CFGRID, however, our web provider does not allow for JAVA to to used. Another option was to set each value up with a unique identifier, i.e., QTY1,QTY2, etc. This way the values can be distinquished when processing them on the action page. I must be having a "blonde" moment, because I am not sure how to do this. The value of NIIN retrieved by the query is unique. This page displays correctly, but, when I try to process this page, I cannot not get the actual value that is stored in the QTY field.

      Any help would be greatly appreciated.

      Here is the code in which I am trying to set up a check box to indicate that the row needs to be updated and the qty that needs to be set.

      <cfquery name="saret_nsn" datasource="SARET">
      select *
      from saret_nsn
      order by niin

      <html xmlns=" http://www.w3.org/1999/xhtml">
      <!-- DW6 -->
      <!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
      <title>SARET Truck Management</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <link rel="stylesheet" href="mm_health_nutr.css" type="text/css" />
      <script language="JavaScript" type="text/javascript">
      //--------------- LOCALIZEABLE GLOBALS ---------------
      var d=new Date();
      var monthname=new Array("January","February","March","April","May","June","July","August","September","Octo ber","November","December");
      //Ensure correct for language. English is "January 1, 2004"
      var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
      //--------------- END LOCALIZEABLE ---------------
      <body bgcolor="#F4FFE4"><cfinclude template="top.cfm">

      <cfform action="truckadd1.cfm" method="post" name="theform" preservedata="true" preloader="no">
      <table border="0" cellspacing="0" cellpadding="0" width="405" >
      <tr align="center">
      <td><b><h5><font color="55119F">Parts Conex ID:</font></h5></b>
      <input name="TRUCKID" type="text" tabindex="2" size="10" maxlength="10" />
      <input name="submit" type="submit" onclick="validate(this); return returnVal;" value="Add Inventory" />
      <tr><td colspan="2"><br></td></tr>
      <td><b><font color="55119F">ADD:</font></b><br /></td>
      <td><b><font color="55119F">QTY:</font></b><br /></td>
      <td><b><font color="55119F">NIIN:</font></b><br /></td>
      <td><b><font color="55119F">NOMEN:</font></b><br /></td>
      <td><b><font color="55119F">SOS:</font></b><br /></td>
      <td><b><font color="55119F">UPRICE:</font></b><br /></td>
      <td><b><font color="55119F">UI:</font></b><br /></td>
      <td><b><font color="55119F">CUBE:</font></b><br /></td>
      <td><b><font color="55119F">WEIGHT:</font></b><br /></td>
      <td><b><font color="55119F">CIIC:</font></b><br />
      <cfoutput query="saret_nsn">
      <input name="ADD" type="checkbox" tabindex="6" value="#NIIN#" />
      <input name="QTY#NIIN#" type="text" tabindex="6" size="10" maxlength="10" />
      <input name="NIIN" type="text" tabindex="7" value="#NIIN#" size="15" maxlength="15" readonly="true" />
      <input name="NOMEN" type="text" tabindex="6" value="#NOMEN#" size="30" maxlength="30" readonly="true" />
      <input name="SOS" type="text" tabindex="7" value="#SOS#" size="3" maxlength="3" readonly="true" />
      <input name="UPRICE" type="text" tabindex="8" value="#UPRICE#" size="10" maxlength="10" readonly="true" />
      <input name="UI" type="text" tabindex="9" value="#UI#" size="3" maxlength="3" readonly="true" />
      <input name="CUBE" type="text" tabindex="10" value="#CUBE#" size="8" maxlength="8" readonly="true" />
      <input name="WEIGHT" type="text" tabindex="11" value="#WEIGHT#" size="8" maxlength="8" readonly="true" />
      <input name="CIIC" type="text" tabindex="12" value="#CIIC#" size="3" maxlength="3" readonly="true" />
      <td><b><font color="55119F"><a href="analystinfo.cfm?analcd=#ANALCD#" target="_blank" >ANALCD:</A></font></b><br />
      <input name="ANALCD" type="text" tabindex="13" onClick="OpenAnalInfo()" value="#ANALCD#" size="5" maxlength="5" readonly="true" />
      <input name="ANALCD" type="hidden" value="#ANALCD#" size="5" maxlength="35" />
      <td align="center"><input name="reset" type="reset" /></td>

        • 1. Re: Setting Unique Values
          BKBK Adobe Community Professional & MVP
          And when you use <cfinput> instead of <input>?

          • 2. Re: Setting Unique Values
            wilsonil Level 1
            I have not tried outputing the form using a cftable.
            • 3. Re: Setting Unique Values
              Dan Bracuk Level 5
              You need neither cfinput nor cftable.

              You say you have this inside a cfoutput tag with a query attribute.
              <input name="QTY#NIIN#" type="text" tabindex="6" size="10" maxlength="10" />

              Put these two lines at the top of your action page
              <cfdump var = "#form#">
              Do you see all the qty fields you should see?
              • 4. Re: Setting Unique Values
                wilsonil Level 1
                Yes, the checkboxes that have been selected show their values along with each value of QTY#NIIN#. Now how do I reference each of these values on the action page?
                • 5. Re: Setting Unique Values
                  wilsonil Level 1
                  Here is the output. I have deleted some of the rows since there are more than 800 rows displayed. The two important fields are displayed - ADD and QTY.

                  ADD 000137137,000179548
                  CIIC U,U,U,7,7
                  CUBE .007,0,.001,.003,.008,.001
                  NIIN 000137137,000137146,000179537,000179539,000179540,000179541,000179546,000179547,000179548
                  QTY000137137 250
                  • 6. Setting Unique Values
                    jdeline Level 1
                    Your action page will have a parameter (comma-delimited list) passed to it called fieldnames. Your QTYxxxxx field names will be in that list. The approach is to go through the list, looking for the first three characters QTY; then verify that everything to the right is numeric, then display it. See concept code below.
                    • 7. Re: Setting Unique Values
                      wilsonil Level 1
                      This works great!!! But another question. How do I obtain the value of the #NIIN# that was appended on the end of the field QTY?
                      • 8. Re: Setting Unique Values
                        Dan Bracuk Level 5
                        Here is some sample code that should give you the general idea. You can work out the specifics.

                        /* the form has check boxes named id1, id2, etc. Some will be checked, some won't. There will also be form fields named appropriate1, appropriate2, etc. We want two lists, one for the selected ids, and one for the corresponding appropriatenes*/
                        idlist = "";
                        appropriatelist = "";

                        for (i = 1; i lte ListLen(form.fieldnames); i = i + 1) {
                        ThisItem = ListGetAt(form.fieldnames, i);
                        if (left(ThisItem, 2) is "id") {
                        ThisNumber = Right(ThisItem, Len(ThisItem) - 2);
                        idlist = listappend(idlist, ThisNumber);
                        ThisOtherItem = "appropriate" & ThisNumber;
                        appropriatelist = ListAppend(appropriatelist, form[ThisOtherItem]);
                        } // left 2 is id
                        } // end of loop

                        later on

                        <cfif listlen(IdList) gt 0>
                        <cfloop from="1" to="#ListLen(IDList)#" index="i">
                        <cfquery name="addrecords" datasource="burns">
                        insert into burns_CaseFirstAid
                        (CaseId, FirstAidID, Appropriate)
                        (#caseid#, #ListGetAt(IDList, i)#, '#ListGetAt(AppropriateList, i)#')

                        • 9. Re: Setting Unique Values
                          wilsonil Level 1
                          THANKS Everyone!!!! You have just made my day!! I have been messing around with this code for days with no luck! It just shows that it is good to ask for help sometimes!!!