Hello,
I would like to cache the form as soon as a certain status is set. But without closing it and without pressing the button.
if (fd.formType == 'Edit'){
fd.field('Status').$on('change',checkStatus);
fd.save();
}
For this I used the function fd.save();. This closes the form. However, it should be possible to continue working.
Best regards
Sternchen
Hello @Sternchen,
You can change the behavior of the form after saving the data. Please find the code example in Prevent redirection on save article.
When I click on the Save button, I should of course be redirected normally. Only if I save automatically in between, as soon as the status changes, no forwarding should take place.
@Sternchen,
You need to use this code in the JavaScript editor:
fd.spSaved(function(result) {
result.RedirectUrl = null;
});
fd.spRendered(function() {
fd.field('FieldName').$on('change', function(value) {
if (value === '33') {
fd.save();
}
})
});
And this code in the Save button's Click property:
var redirect = fd.source;
fd.spSaved(function(result) {
result.RedirectUrl = redirect;
});
return fd.save();

Thanks for the help but where is the click button in the form?
I can´t see one. It´s the default save button from sp.

I don´t think I can change the behavior.
Best regards
Sternchen
@Sternchen,
You can add a custom buttons to the form and hide toolbar:

Or customize the toolbar button behavior:
//change save button click function
fd.toolbar.buttons[0].click = function() {
var redirect = fd.source;
fd.spSaved(function(result) {
result.RedirectUrl = redirect;
});
return fd.save();
}
I used your second option and it worked just fine. Thank you.

1 Like