List or Library Control: Option for save new item

Hi,

The normal SharePoint quick edit can automatically save the item by press Enter only. Is there an option to do it from Forms instead of click on the pencil icon to save the item one by one. If new line item is display without click on the Add new item button again would be great also.

Thank you.

Hello @noorshahida88 !

Please paste the following code in Javascript editor to save items in inline mode by press Enter.

fd.spRendered(function() {
	document.onkeypress = function (e) {
   if(e.keyCode == 13){
$('.k-grid-update').click();
    }
};
});

Thank you so much @mnikitina
You have save my day :slight_smile:

1 Like

Hi @mnikitina , is there any best way to ensure user click the save box or click Enter before form is save? This is because a few of my users always forgot to click either both options, causing those items not save to the form.

@noorshahida88,

You can add a custom validator that will check if a control has unsaved lines. Please find the code below.

fd.validators.push({
    name: 'MyCustomValidator',
    error: "Please save rows",
    validate: function(value) {
        return fd.control('SPDataTable0').widget.element.find('.k-i-check').length==0;
    }
});
1 Like