Force options on a form

Hello, i have a situation, i have a huge form,
but the form is to be called from 2 different places, and depending on the places its called, a option must be set to true or false, and depending on that option, the enabled fields, must change, and the options in selects must change,

I have a prototype of the selects working and depending on a configuration the values are show, but i dont know how to make it so that when i call the form to pass the parameter

Here is a over simplification of the form

http://webix.com/snippet/44f44755

I want that instead of the closeAccount Option to be hard coded, i can be parameter that the form receive, and depending on that also some fields
are disabled

Hello,

You can initialize a a select box with an empty set of options, and aftwerwards define the needed option collection depending on its value:

//define 'onChange' handler that will set options
webix.protoUI({
   $cssName:"select",
   name:"closecodeselect",
   $init:function(config){
       this.attachEvent("onChange", function(newv, oldv){ 
           this.define({options:getCloseCodes(newv)});
           this.refresh();
      });
   },
},webix.ui.select);

//initialize empty select box
{ view:"select", name:"a", options:[]}

//set select value dynamically
$$("cardStatudFormid").elements["a"].setValue(true);

Please, check the updated snippet: http://webix.com/snippet/e7bc7972

Also, you can include the getCloseCodes method into the Select’s prototype for cleaner code: http://webix.com/snippet/ab22a552