I've been using the Form plugin for a while a just recently (within
the last week) something has gummed up the works and I'm not sure
what. Here is my code.
$().ready( function(){
$('#productListForm').ajaxForm({
target: '#toolList',
error: function(request, textStatus, errorThrown){
$("#toolList").html( request.responseText );
}
});
$('.oep_search').autocomplete('consolidator/fetch_oep.asp', {
width: 250,
minChars: 2,
cacheLength: 1
});
$(".oep_search").result(function(event, data, formatted) {
if (data){
table = $(this).parents("table");
table.find('input[name=oepid]').val( data[1] );
sel = table.find('.lruSelector');
sel.show();
$.ajax({type: "POST",
url: "consolidator/fetch_lru.asp",
data: { id: data[1] },
success: function(data){
sel.html( data );
$("#toolList").html( ajaxloader );
$("#productListForm").submit(); // this call
works
},
error: function(request, textStatus, errorThrown){
sel.html( request.responseText );
}
});
}
});
});
function fetchTools(){
$("#toolList").html( ajaxloader );
$("#productListForm").submit(); // this call does not
}
The ajax call in $('#oep_search').result() (from an autocomplete
plugin) adds some checkboxes to the form. Each checkbox has an
onclick="fetchTools()" on it. The first call to submit the form in the
ajax success function works. It doesn't change the page and populates
the output div like it should. However, any subsequent attempts to
submit the form don't work. There are two possible ways to trigger a
submit. Either clicking on a checkbox or triggering the autocomplete
result function again. Neither works the second time around. The form
is submitted the old fashioned way and I'm taken away from the page.
This used to work like a champ. I have no idea what has changed. I
haven't been mucking about with the javascript code. No need. I was
using jquery 1.2.6 and form plugin 2.17. I updated to 1.3.2 and 2.18
respectively, but that did not help. This happens both in Firefox and
IE.
Does this ring bells for anyone? Can someone give me some ideas on
what I should be looking for?
-Sean