I inherited a CF site recently and have been able to work through most of the issues I have run into. However, there is this one problem which I can not solve. I have a page with a form that contains 4 elements. Date, PaymentAmount, DisbursementID, and I have now added PayNote.
The query looks like this:
<CFLOOP FROM="1" TO="#ListLen(FORM.disbursementID)#" STEP="1" INDEX="i">
<CFIF i IS NOT "">
SET paymentDueDate = #CreateODBCDate(CreateDate(ListGetAt(FORM.year,i), ListGetAt(FORM.month,i), ListGetAt(FORM.day,i)))#, paymentAmount = #ListGetAt(FORM.paymentAmount,i)#, payNote = '#ListGetAt(FORM.payNote,i)#'
WHERE disbursementID = #ListGetAt(FORM.disbursementID,i)#;
The form can contain multiple payments and a ListGetAt function is being used to put all of the elements into a list to loop through and update the database for each Disbursement ID. After reading a lot of questions and answers on EE yesterday and this morning about this particular CF function, I am still getting the index error. I know that is a element is empty, CF ignores it.
Let's say there are 15 payments that need to be updated. If the end user loads the form displaying the 15 payments that need to be rescheduled but only needs to add a note for 3 of the 15 payments, when they click Update All, I get this error.
In function ListGetAt(list, index [, delimiters]), the value of index, 2, is not a valid as the first argument (this list has 1 elements). Valid indexes are in the range 1 through the number of elements in the list.
Any ideas? As always, thank you in advance for your help.