I'm trying to use the recipe on p. 142 of the web2py cookbook (Uploading
files using a LOADed component) and I'm wondering if there's an error in
the replacement web2py_trap_form function. Line 4 of the replacement
provides an 'if' condition with no statements following (no { } at all). Is
this correct?
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
if(!form.hasClass('no_trap'))
if(form.find('.upload').length>0) {
form.ajaxForm({
url: action,
success: function(data, statusText, xhr) {
jQuery('#'+target).html(xhr.responseText);
web2py_trap_form(action,target);
web2py_ajax_init();
}
});
} else {
form.submit(function(e){
jQuery('.flash').hide().html('');
web2py_ajax_page('post',action,form.serialize(),target);
e.preventDefault();
});
}
});
}
Thanks,
Ian