Save Wizard on any step without redirection (on new Form)


#1

Dear Plumsail team,

On new record and In order to get a record ID as i need it to continue a wizard step where a sub lists is implemented i tried the following script :

	/*On Step II in Wizard save witout redirection 
	to get ID and complete wizard with sub parent lists
	0 is the index of the first step */
	    fd.container("WizardNewPerson").widget.$on("update:startIndex", function() {
	        if (fd.container("WizardNewPerson").widget.activeTabIndex == 1){
				//Save
					fd.save()
	        	}
	   		 });
			 
			 

	// force form to stop redirection if save is requested on second step
		fd.spSaved(function(res) {
		if (fd.container("WizardNewPerson").widget.activeTabIndex == 1){
				//Save no redirectioon
    			res.RedirectUrl = null;
				}
		});
  • First the script is validating i need to save without validation just on wizard step index(1).
  • Second even if i fill the requested validation rules the form is saving and doing redirection.

So i need to save and get ID without validation and stop redirection when i am on wizard step index(1)

This process is to access Parent/Child sub form lists and create new sub lists records and force it to get the parent form ID unless you have another solution (On New form) kindly share it.

Thank you for your urgent reply.


#2

Dear Georges,

As a workaround, you can redirect to the Edit form, then a record ID will be available.


#3

Dear AlexZever,

What do you mean there is no solution on new record form to get ID without redirection to the edit form???
As my need is to keep user working in wizard mode on new record but on edit mode no wizard process and i will show all the controls possibilities to fill.


#4

Dear Georges,

I’m sorry, I’m not sure I understand what you try to implement :disappointed_relieved: Could you please provide some screenshots so I could take a closer look?


#5

Foregive me for my bad clarification.
I am developing this application in Arabic interface for an Arabic church.
I am afraid if i sent you screenshots you will not understand the contents.

I will try to give you more info as follow:

I am creating forms for a certain list 3 modes:
New, edit and display forms.

  • The New form is a wizard steps form( contains the minimum primary fields for data entry that users must fill with multiple sublist “parent/child lists”).

  • Edit and display form are normal forms no wizard steps availabe and contains the hole list fields.

On the new form wizard:
I need to be sure that the parent list will create or have an ID before entering data in the sub child lists.
To get an ID i need to save without redirection as for the wizard steps are only available in the new form where the end user must continue to the end of the steps.

More explanation:
The new form wizard has 10 steps
the third, 4th and the 5th steps has sub child lists.
When the user press next on the second step
I need to save the form in order to get ID without redirection where user can continue the rests of the wizard steps.
After the user press finish (last wizard step) it will save again and redirect to edit form.

How to save the new form and get ID without redirection to the edit form as for the wizard is only available in the new form.

Hope i gave you the right information.
Thank you again for your patient.


#6

Dear Georges,

Please consider this code:

fd.rendered(function() {        
    window.wizardFlag = false; 
    fd.container("WizardNewPerson").widget.$on("update:startIndex", function() {
        if (fd.container("WizardNewPerson").widget.activeTabIndex == 1){
            wizardFlag = true;
            fd.save();
        }
    })
}) 

fd.spSaved(function(result) {
    if (wizardFlag) {
        console.log(result.Id);
        result.RedirectUrl = null;
    }   
});

Notice that “result.Id” is the ID of the saved item.


#7

Dear AlexZver,
i want to thank you for your precious help.
I couldn’t have time to test this scripts i was focusing on something else.

for the code i tested it with a small correction:

window.wizardFlag = false;
fd.container("WizardNewPerson").widget.$on("update:startIndex", function () {
    if (fd.container("WizardNewPerson").widget.activeTabIndex === 1) {
        wizardFlag = true;
        fd.save();
    }
});

fd.spSaved(function (result) {
    if (wizardFlag) {
        console.log(result.Id);
        result.RedirectUrl = null;
    }
});

it works thanks but how to prevent or disable validation during the save process on the second wizard step only for sure?!
I am using multiple validation codes like:

//Validation marital Status
//fd.field('PersonMaritalStatus').validators;
fd.field('PersonMaritalStatus').validators.push({
    name: 'ValidateMaritalStatus',
    error: '',
    validate: function (value) {
        if (value === 8 || value === null) {
            this.error = 'Select Marital Status';
            return false;
        }
        return true;
    }
});

thank you


#8

Dear Georges,

As a workaround, you can add a condition fd.container("WizardNewPerson").widget.activeTabIndex == 1 to your validators to disable validation if the tabIndex equals 1.

Please notice that you can’t disable the global validation like the Sharepoint required fields but you can turn it off and override it in the custom validators.


#9

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)


#10

it works like a charm… very excited thanks a lot dear AlexZver.