Need to set JSON to form

Hi,

I need to set JSON to my form which is a bit complex. Actually, the additional user is added when somebody clicks on that button “Create Additional Portal User Account for this Customer”.

I want that when a JSON having those additional customers should be appended to this form.

http://webix.com/snippet/0d1b995e

It depends in what format you want to receive form data. You can write a custom method that collects data from the main form as well as the additional ones:

var  formsData = {};
formsData.main=  $$("customerDetailsForm").getValues();
              
formsData.extra = {};
var extras  = $$("additionalCustomerAdd").getChildViews();
for(var i in extras)
  	formsData.extra[i] = extras[i].getValue();
              
 console.log(formsData);

http://webix.com/snippet/7e546967

I think you didn’t understand my issue.

I need to set the JSON provided in the snippet to form. And form should have as many additionalPortalUserAccounts as many of the json array have.

I see. Sorry for misunderstanding.

To set the values, you can check whether an extra form exists at the moment, and if not, create the one: http://webix.com/snippet/9dfdf179.

I modified your json there for zero-based definition of additionalPortalUserAccounts.

Perfect!

If I put a button in the sub-form to remove it, I can remove it. But a small problem I am facing is, when I set the values, it removes from view but getValues of the form contains the JSON in it(Press Next button after setValue and removing any view then count number of AdditionalPortalUserAccounts JSON in console ).

??