Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Changing the functionality of the inline edit.

Changing the functionality of the inline edit. 1 year 7 months ago #57996

  • d3vnu77
  • d3vnu77's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
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.

Is this possible?
The administrator has disabled public write access.

Changing the functionality of the inline edit. 1 year 7 months ago #58021

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10667
  • Thank you received: 1604
  • Karma: 364
This is where the code is:
include/InlineEditing/inlineEditing.js:316:                var r = confirm(SUGAR.language.translate('app_strings', 'LBL_CONFIRM_CANCEL_INLINE_EDITING') + ' ' + message_field);

So you can try adapting it to your needs by customizing.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
Last Edit: 1 year 7 months ago by pgr. Reason: add code tags
The administrator has disabled public write access.
The following user(s) said Thank You: d3vnu77

Changing the functionality of the inline edit. 1 year 7 months ago #58038

  • d3vnu77
  • d3vnu77's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
Cool. I was able to add the functionality I wanted. If anyone else is interested here is what i did:

To save and move to the next tab (when pressing the tab key), I added this to the bottom of the validateFormAndSave function
$(document).keydown(function(e) {
        if (e.which == 9 && !e.shiftKey) {
            $inlineEdits = $('div.inlineEdit');          
            e.preventDefault();
            $("#inlineEditSaveButton").click();
            $tabNext = false;
            $inlineEdits.each(function (index, value)
            {
                if($tabNext == true) { $(value).dblclick(); }
                if($(value).hasClass('inlineEditActive')) { $tabNext = true; }
            });
        }
    });

To remove alert and save when clicking out I change the $(document).on('click', function (e)
if (alertFlag) {
              e.preventDefault();
              $("#inlineEditSaveButton").click();
            } else {
Last Edit: 1 year 7 months ago by d3vnu77.
The administrator has disabled public write access.

Changing the functionality of the inline edit. 1 year 7 months ago #58050

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10667
  • Thank you received: 1604
  • Karma: 364
Hey thanks for posting that code. Did you get it working under the "custom" directory? Just trying to make sure it's upgrade-safe.

Another question: is that "save and move focus" code something you think should be added to SuiteCRM?

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Changing the functionality of the inline edit. 1 year 7 months ago #58322

  • d3vnu77
  • d3vnu77's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
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.
The administrator has disabled public write access.

Changing the functionality of the inline edit. 6 months 2 weeks ago #77462

  • AlxGr
  • AlxGr's Avatar
  • Offline
  • SuiteCRM Is My Life
  • Posts: 325
  • Thank you received: 58
  • Karma: 11
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();
        }
    });
}

Thanks,
I can help you with your customization. Requests at ctmprograATondsystemsDOTcom
No dude en contactarme si necesita personalizar su aplicación. Mi email es ctmprograARROBAondsystemsPUNTOcom
Last Edit: 6 months 2 weeks ago by AlxGr.
The administrator has disabled public write access.
The following user(s) said Thank You: pgr

Changing the functionality of the inline edit. 4 months 1 week ago #82084

  • holdusback
  • holdusback's Avatar
  • Offline
  • Premium Member
  • Posts: 153
  • Thank you received: 8
  • Karma: 0
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.

Looking for an "upgrade-safe" method !
The administrator has disabled public write access.
Time to create page: 0.096 seconds
Powered by Kunena Forum