When you click away from the inline edit without clicking the checkmark, you get a javascript popup that says:
You have clicked away from the field you were editing without saving it. Click ok if you’re happy to lose your change, or cancel if you would like to continue editing “THE FIELD”?
Is it possible to make the field save instead when clicking away?
Secondary, it would also be benefital to my application to be able to tab to the next field saving the field upon each subsequent tab.
No its not working under the custom directory. I’m not sure what to do there. Also the code seems to work ok in firefox, but is copying the previous field data to the next field when tabbing in chrome and edge. Going to look into that this week.
As far as using it in SuiteCRM, im all for it. It helps me quickly enter data in my specific data entry application i need it for. Not sure how helpful itd be outside those bounds.
I want to share the following in case somebody need to customize this file. Following your sample I found I can display custom messages based on the module the function is called from.
In this case I’m presenting a message box when inline edit occurs on the Opportunities module:
function validateFormAndSave(field,id,module,type){
$("#inlineEditSaveButton").on('click', function () {
var valid_form = check_form("EditView");
if(valid_form){
// HERE MY CODE to identify the module I want to show the message
if (module == "Opportunities"){
handleSave(field, id, module, type)
clickListenerActive = false;
$('[field="'+field+'"]').addClass('fix-inlineEdit-textarea');
// HERE we user the ALERT BOX to present the message on the Opportunities module only
alert("Hello! I am an alert box!!");
}else{
handleSave(field, id, module, type)
clickListenerActive = false;
$('[field="'+field+'"]').addClass('fix-inlineEdit-textarea');
};
}else{
$('[field="'+field+'"]').removeClass('fix-inlineEdit-textarea');
return false
};
});
// also want to save on enter/return being pressed
$(document).keypress(function(e) {
if (e.which == 13 && !e.shiftKey) {
e.preventDefault();
$("#inlineEditSaveButton").click();
}
});
}
Does anyone find a way to delete this alert in the custom folder ? If I delete the code in the original js file it work, but its not really good to edit original file…
You can delete this by commenting this in /include/InlineEditing/InlineEditing.js :
/*if (user_value != output_value_compare) {
message_field = message_field != 'undefined' ? message_field : '';
var r = confirm(SUGAR.language.translate('app_strings', 'LBL_CONFIRM_CANCEL_INLINE_EDITING') + ' ' + message_field);
if (r == true) {
var output = setValueClose(output_value);
clickListenerActive = false;
} else {
$("#" + field).focus();
e.preventDefault();
}
} else {
// user hasn't changed value so can close field without warning them first
var output = date_compare ? setValueClose(user_value) : setValueClose(output_value);
clickListenerActive = false;
}*/
Super anoying when you select the field value with the mouse (like a ctrl A) and the click out event is outside the field, you get that alert… Terrible for the workflow ahah.