Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comma delimited list not returning "0" values 1

Status
Not open for further replies.

CFDev

Programmer
Joined
Aug 24, 2001
Messages
8
Location
US
I'm trying to pass the following 9 data values from an update.cfm to an action page:
8.67, B, 25.00, B, B, 96.00, B, B, B
(B is an indicator for a check box which, when selected, bypasses the records and should produce a value of 0)

However, a check of my ouptput returns:
8.67,25.00,96.00
.....so it is bypassing the appropriate records but instead of putting a value of 0 in the field, it leaves it blank. Without this, it will not update the database correctly. Any thoughts?

My update.cfm input fields are as follows:

<input type=&quot;checkbox&quot; name=&quot;BypassMthCheck_list&quot; VALUE=&quot;#RowIndex#&quot; CHECKED>
<CFELSE>
<input type=&quot;checkbox&quot; name=&quot;BypassMthCheck_list&quot; VALUE=&quot;#RowIndex
</CFIF>
<INPUT TYPE=&quot;text&quot; NAME=&quot;actl_perf_amt_list&quot; SIZE=&quot;10&quot; MAXLENGTH=&quot;10&quot; VALUE=&quot;#perfArray[RowIndex][2]>


And the action is:

<CFTRANSACTION>
<CFLOOP Index=&quot;ListRead&quot;
From =&quot;1&quot; To=&quot;#FormrecCount#&quot;>

<CFIF NOT parameterExists (BypassMthCheck)>
<CFSET ignore_month = &quot;N&quot;>
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, &quot;,&quot;)#>

<CFELSEIF ListContains(BypassMthCheck, ListRead, &quot;,&quot;) IS 0>

<CFSET ignore_month = &quot;N&quot;>
<CFSET msur_actl_perf_amt = #ListGetAt(form.actl_perf_amt, ListRead, &quot;,&quot;)#>
<CFELSE>
<CFSET ignore_month = &quot;Y&quot;>
<CFSET msur_actl_perf_amt = 0>
</CFIF>

WHAT AM I MISSING!!

Donna Hodgson
Systems Analyst

 
A couple of abservations:

Unless these are typos, it appears that you are missing some pound signs:

<input type=&quot;checkbox&quot; name=&quot;BypassMthCheck_list&quot; VALUE=&quot;#RowIndex
</CFIF>
<INPUT TYPE=&quot;text&quot; NAME=&quot;actl_perf_amt_list&quot; SIZE=&quot;10&quot; MAXLENGTH=&quot;10&quot; VALUE=&quot;#perfArray[RowIndex][2]>


like right after VALUE=&quot;#RowIndex and right after VALUE=&quot;#perfArray[RowIndex][2]>

unless you are trying something I'm not familiar with. Also, bear in mind that checkboxes don't pass anything -- no null, no zero, nothing -- unless they are checked. So, it is good to either predefine the variable they represent using <cfparam name=&quot;form_var_1&quot; default=&quot;0&quot;>
or you can set the default value using a hidden form field:

<input type=&quot;HIDDEN&quot; name=&quot;form_var_1&quot; value=&quot;0&quot;>

Then, if the checkbox gets checked, the value passed will be &quot;0,1&quot; and you can check for the &quot;1&quot; using:

<cfif #form.form_var_1# CONTAINS &quot;1&quot;>

John Hoarty
jhoarty@quickestore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top