{
    "customFields": {
        "form": [{
                "title": "Name",
                "key": "name",
                "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
                "type": "text",
                "placeholder": "Full name",
                "required": true,
                "feedback": false,
                "disableSuccessState": false,
                "disableErrorState": false
            },
            {
                "title": "Age",
                "name": "age",
                "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
                "key": "age",
                "type": "number",
                "placeholder": "Age (In years)",
                "required": false,
                "feedback": false,
                "disableSuccessState": false,
                "disableErrorState": false
            },
            {
                "title": "NIC",
                "key": "nic",
                "htmlClass": "col-md-6 col-sm-6 col-xs-12 col-lg-6",
                "type": "text",
                "placeholder": "NIC number",
                "required": true,
                "feedback": false,
                "disableSuccessState": false,
                "disableErrorState": false
            }
        ],
        "schema": {
            "type": "object",
            "properties": {
                "name": {
                    "type": "string",
                    "title": "Name"
                },
                "age": {
                    "type": "integer",
                    "maximum": 125,
                    "minimum": 0,
                    "title": "Age",
                    "x-schema-form": {
                        "type": "number",
                        "max": 125,
                        "min": 0
                    }
                },
                "nic": {
                    "type": "string",
                    "title": "NIC"
                }
            }
        }
    },
    "onLoad": "if (scope.visitor != null ) { var names = []; if(scope.visitor.firstName.length > 0) names.push(scope.visitor.firstName); if(scope.visitor.lastName.length > 0) names.push(scope.visitor.lastName); scope.customModel.name = names.length > 0 ? names.join(\" \") : \"\"; }; ",
    "beforeSubmit": "var names = scope.customModel.name.split(\" \")\n            if(names.length > 0) {\n                if(names[0]) {\n                    scope.defaultModel.firstName = names[0]\n                    names.shift()\n                }\n            }\n            if(names.length > 0){\n                scope.defaultModel.lastName = names.join(\" \")\n            }else{scope.defaultModel.lastName =\"\"} \nconsole.log('Before submit:',scope.defaultModel)"
}