I've tried every possible combination I can think of so I hope someone here
can see something I'm missing...  I have a form with multiple line items and
I want to have a few of the fields validated against my database to make
sure the values exist.  My code is as follows:

I've got a select form element to pick a department:

<td class="cellvalue_l" style="text-align:left;">
                    <select name="dept" id="dept0"
style="font-family:Tahoma;">
                      <cfoutput query="getdept">
                        <option value="#id_dept_instance#">#name#</option>
                    </cfoutput>
                  </select>
                </td>
...

I loop to create an initial ten blank line items:

<cfloop index="cnt" from="1" to="10">
                <tr id="Form0_tr<cfoutput>#cnt#</cfoutput>">
                  <td><input type="text" style="width:120px;"
id="job<cfoutput>#cnt#</cfoutput>" name="job<cfoutput>#cnt#</cfoutput>"
/></td>
                  <td><input type="text" style="width:35px;"
id="elem<cfoutput>#cnt#</cfoutput>" name="elem<cfoutput>#cnt#</cfoutput>"
/></td>
...
                </tr>
              </cfloop>

...


var methodURL = 'http://<cfoutput>#CGI.HTTP_HOST#</cfoutput>/';

$(document).ready(function() {
    function checkValue(li) {
        alert($('#job1').val());
    }

for (var i=1;i<=10;i++) {
The first autocomplete finds valid job numbers based on the dept selected

            $('#job'+i).autocomplete(methodURL,
                {
                     minChars:4
                    ,timeout:3000
                    ,matchContains:1
                    ,cacheLength:1
                    ,extraParams:{
                         'fuseaction':'j.jobnumber_autocomplete'

,'company':document.getElementById('dept0').options[document.getElementById('dept0').selectedIndex].text
                    }
                }
            );

The 2nd autocomplete finds valid elements based on the 1st job number found:

            $('#elem'+i).autocomplete(methodURL,
                {
                     minChars:1
                    ,timeout:3000
                    ,matchContains:1
                    ,cacheLength:1
                    ,onItemSelect:checkValue
                    ,extraParams:{
                         'fuseaction':'j.elements_autocomplete'
                        ,'jobno':$('#job'+i).val()
                    }
                }
            );

        }
    });
}

My problem is that the 2nd autocomplete queries and returns valid values but
does not seem to pass my 2nd parameter (jobno).  The record from my web
server access log is as follows:
q=95&fuseaction=j.elements_autocomplete&jobno=
Jobnumber should have a large integer value (eg 10024500001000000).

What irritates me is that my 1st autocomplete works perfectly but the 2nd
one doesn't no matter what I try (even if I replace '#job'+i with 'job1').
I am desperate for any useful insight...


tia,

 - Joe

-- 

Failure is always an option -- Adam Savage

Reply via email to