I have a problem with the upload file using the LOAD (....., ajax = True)please .. any help, cues or snippets of codes to accomplish this ... will be greatly appreciatedPicheth.
*Please note:* Because Ajax post does not support multipart forms, i.e. file uploads, upload fields will not work with the LOAD component. You could be fooled into thinking it would work because upload fields will function normally if POST is done from the individual component's .load view. Instead, uploads are done with ajax-compatible 3rd-party widgets and web2py manual upload store commands.
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();
});
}
});
}
--
Hi Anthony,This solution you mention is, with some minor changes, still working in the current version. I've managed to get the change working in the 2.12.3 version of web2py.js:Change function trap_form to:
Hello Mike,could you explain your patch to web2py-developers? it is quite extensive.