Different behaviour of fd.save()

Hello there,

I have a wizard form with several steps.

In each step i want to create a button where the user can save the work progress --> return to the same tab (no problem in edit mode). But if the user is going to complete the wizard, it should save the entry and redirect the user to a homepage (redirecting also no problem).
Can i create a button where the user can click on and the form will be saved and continue the wizard progress until the end and finish with the redirection to a "homepage"???
Can i make two different fd.save() events?

Dear @DanielB,
It depends on what exactly you want to be different, but usually yes - it's not that the event itself will be different, but you can add condition checks inside fd.spBeforeSave() and fd.spSaved() events.

Something like this:

fd.spSaved(function(result){
  if(fd.field('LastField').value == 'Complete'){
    result.RedirectUrl = 'Homepage URL';
  }
});

I want to use a button on every wizard page to save the form. --> User stay at the form (change to edit form)
But if i finish the wizard the user also stays on the edit form. But the user should be referred to a url.

I do not have a condition. The only condition is, if the user clicks on the "save-button" he should be able to continue working. And if the user finishes the wizard the user should be referred to a url.

I am not a programmer and this is my code so far

fd.spSaved(function(result){
  if(fd.container("Wizard").widget.$on("on-complete", function() {
        fd.field('Status').value = '1 - Submitted';
        fd.messages.PlumsailForm_Submission_Success = "Your idea was submitted";
        result.RedirectUrl = "blablabla/Idee-submitted.aspx";
        }
  else(fd.field('Status').value == ' ') && (fd.field('ID').value == ' ') {
    fd.messages.PlumsailForm_Submission_Success = "Idea saved!";
    fd.field('Status').value = '0 - Saved';
    result.RedirectUrl = null;
  }
});

Dearr @DanielB,
I think the easiest option in this case would be to change every button on the form that can be changed - add code like this to the Click property:

window.customSaveButton = true;
fd.spSaved(function(result){
    fd.messages.PlumsailForm_Submission_Success = "Idea saved!";
    fd.field('Status').value = '0 - Saved';
    result.RedirectUrl = null;
});
fd.save();

And the following code can be used in the JavaScript editor - it will apply to the save from the Wizard:

window.customSaveButton = false;
fd.spSaved(function(result){
  if(window.customSaveButton == false) {
        fd.field('Status').value = '1 - Submitted';
        fd.messages.PlumsailForm_Submission_Success = "Your idea was submitted";
        result.RedirectUrl = "blablabla/Idee-submitted.aspx";
     }
});
1 Like