• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting Unique Values

New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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
</cfquery>


<html xmlns=" http://www.w3.org/1999/xhtml">
<!-- DW6 -->
<head>
<!-- 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","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
</head>
<body bgcolor="#F4FFE4"><cfinclude template="top.cfm">

<td>
<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" />
</td>
</tr>
<tr><td colspan="2"><br></td></tr>
<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 />
</tr>
<tr>
<cfoutput query="saret_nsn">
<td>
<input name="ADD" type="checkbox" tabindex="6" value="#NIIN#" />
</td>
<td>
<input name="QTY#NIIN#" type="text" tabindex="6" size="10" maxlength="10" />
</td>
<td>
<input name="NIIN" type="text" tabindex="7" value="#NIIN#" size="15" maxlength="15" readonly="true" />
</td>
<td>
<input name="NOMEN" type="text" tabindex="6" value="#NOMEN#" size="30" maxlength="30" readonly="true" />
</td>
<td>
<input name="SOS" type="text" tabindex="7" value="#SOS#" size="3" maxlength="3" readonly="true" />
</td>
<td>
<input name="UPRICE" type="text" tabindex="8" value="#UPRICE#" size="10" maxlength="10" readonly="true" />
</td>
<td>
<input name="UI" type="text" tabindex="9" value="#UI#" size="3" maxlength="3" readonly="true" />
</td>
<td>
<input name="CUBE" type="text" tabindex="10" value="#CUBE#" size="8" maxlength="8" readonly="true" />
</td>
<td>
<input name="WEIGHT" type="text" tabindex="11" value="#WEIGHT#" size="8" maxlength="8" readonly="true" />
</td>
<td>
<input name="CIIC" type="text" tabindex="12" value="#CIIC#" size="3" maxlength="3" readonly="true" />
</td>
<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>
</tr>
</cfoutput>
<tr>
<td align="center"><input name="reset" type="reset" /></td>
</tr>
</table>
</cfform>
</tr>
</table>

</td>
</tr>
</table>
</body>
</html>
TOPICS
Advanced techniques

Views

644

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

And when you use <cfinput> instead of <input>?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

I have not tried outputing the form using a cftable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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#">
<cfabort>
Do you see all the qty fields you should see?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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
ANALCD SAUCG,SAUCG,LAC6D,LAC6D,SIRRN
CIIC U,U,U,7,7
CUBE .007,0,.001,.003,.008,.001
FIELDNAMES TRUCKID,SUBMIT,ADD,QTY000137137,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000137146,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179537,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179539,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179540,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179541,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179546,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,QTY000179547,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD,ADD,QTY000179548,NIIN,NOMEN,SOS,UPRICE,UI,CUBE,WEIGHT,CIIC,ANALCD,ANALCD
NIIN 000137137,000137146,000179537,000179539,000179540,000179541,000179546,000179547,000179548
NOMEN PIN,COTTER,PIN,COTTER,PIN,GROOVED,HEADED,PAWL,FORWARD ASSIST,DETENT,PAWL,SPRING,HELICAL,COMP,HANDLE ASSEMBLY,CHA,PIN,FIRING,CATCH,BOLT,CATCH,MAGAZINE,SPRING,HELICAL,COMP,PLUNGER,BOLT
QTY000137137 250
QTY000137146
QTY000179537
QTY000179539
QTY000179540
QTY000179541
QTY000179546
QTY000179547

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

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)
values
(#caseid#, #ListGetAt(IDList, i)#, '#ListGetAt(AppropriateList, i)#')
</cfquery>
</cfloop>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 19, 2006 May 19, 2006

Copy link to clipboard

Copied

LATEST
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!!!

Wendy

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation