I need help with this again, almost works but not quite.
Here is the code I have for my form :
<cfoutput query="qry">
<tr>
<td align="center"><cfinput type="checkbox"
name="del/#ref_number#/#ref_line_item#" value="Yes"></td>
<td align="center">#ref_line_item#</td>
<td align="center">#ref_action#</td>
<td align="center">#quantity#</td>
<cfif qry.ref_action is "Receive">
<td>PO: #qry.po_number#,
Item: #qry.item#, P/N: #qry.part_number#</td>
<cfelseif qry.ref_action is "RTV">
<td>Shipping Document Number:
#qry.tracking_number#</td>
<cfelseif qry.ref_action is "Other">
<td>Instructions: #qry.instructions#</td>
</cfif>
<td align="center"><cfinput type="text"
name="comments/#ref_number#/#ref_line_item#" size="50"
maxlength="50"></td>
</tr>
</cfoutput>
I am,attepting to associate the commets field with the
checkbox field.
Here is my action page :
<cfif isDefined("form.fieldnames") and
mid(form.fieldnames,1,4) is "Del/">
<cfloop index="i" list="#form.fieldnames#"
delimiters=",">
<cfif left(i,4) is "del/">
<cfset select_ref_number = listgetat(i, 2, "/")>
<cfset select_ref_line_item = listlast(i, "/")>
<cfset commentsName =
"comments/#select_ref_number#/#select_ref_line_item#">
<cfset select_comments = form[commentsName]>
<cfif select_comments is "">
<cflocation
url="form.cfm?showAlert&ref_number=#select_ref_number#&line_item=#select_ref_line_item#">
</cfif>
update query goes here
</cfif>
</cfloop>
<cfoutput>
<cflocation
url="next_form.cfm?ref_number=#form.ref_number#">
</cfoutput>
<cfelse>
<cfoutput>
Error Message goes here
</cfoutput>
</cfif>
If none of the checkboxes are selected and the form
submitted, I need to display an error message. If any of the
chekcboxes are selected but the comments are blank, then I need to
display anohter error message.The form should only submit if at
least one of the checkboxes are checked and there are commets.
It seems to work halfway. If the errors are detected, and
corrected, the errors continue to come up. If it is done right the
first time (checkbox and commerts), it seems to work fine.
But overall, I think it is not working.
Can someone please help and tell me what I am doing wrong ?
Thanks