I think that a useful feature would be the autosave of the record when the user uploads a new file. This avoid to have tons of orphans files in the filesystem when the user forget to save the record.
I'm trying to reverse engeenering but there is no way to retrieve the record id after an upload. (without deep modifying all the functions chain)
Autosave on Upload
Started by xsigno, 07 November 2011 - 23:26 PM
- Single Page
Posted 07 November 2011 - 23:26 PM
Posted 25 July 2012 - 10:58 AM
I add $("#crudForm").submit(); in assets/grocery_crud/js/jquery_plugins/config/jquery.fileupload.config.js
on
on
done: function (e, data) {
if(typeof data.result.success != 'undefined' && data.result.success)
{
$("#loading-"+unique_id).hide();
$("#progress-"+unique_id).html('');
$.each(data.result.files, function (index, file) {
$('#upload-state-message-'+unique_id).html('');
$("input[rel="+uploader_element.attr('name')+"]").val(file.name);
var file_name = file.name;
$('#file_'+unique_id).html(file_name);
$('#file_'+unique_id).attr('href',file.url);
$('#hidden_'+unique_id).val(file_name);
//$('#'+uploader_id).hide();
$('#success_'+unique_id).fadeIn('slow');
$('#delete_url_'+unique_id).attr('rel',file_name);
$('#upload-button-'+unique_id).slideUp('fast');
});
}
else if(typeof data.result.message != 'undefined')
{
alert(data.result.message);
show_upload_button(unique_id, uploader_element);
}
else
{
alert(error_on_uploading);
show_upload_button(unique_id, uploader_element);
}
// I ADD THIS HEAR//
$("#crudForm").submit();
},