angular icon indicating copy to clipboard operation
angular copied to clipboard

Minimal schema on formbuilder json

Open settysreekanth opened this issue 2 years ago • 1 comments

we are using form-builder in our project and we are passing below form schema to the builder as input property however the JSON gets updated with all the default values in the json preview. How to get the minimal schema without default values?

Input form schema:

{
	"components": [
		{
			"label": "Text Field",
			"applyMaskOn": "change",
			"tableView": true,
			"key": "textField",
			"type": "textfield",
			"input": true
		},
		{
			"type": "button",
			"label": "Submit",
			"key": "submit",
			"disableOnInvalid": true,
			"input": true,
			"tableView": false
		}
	]
}

Updated Schema which includes all default values:

{
  "components": [
    {
      "label": "Text Field",
      "applyMaskOn": "change",
      "tableView": true,
      "key": "textField",
      "type": "textfield",
      "input": true,
      "id": "e46q82x",
      "placeholder": "",
      "prefix": "",
      "customClass": "",
      "suffix": "",
      "multiple": false,
      "defaultValue": null,
      "protected": false,
      "unique": false,
      "persistent": true,
      "hidden": false,
      "clearOnHide": true,
      "refreshOn": "",
      "redrawOn": "",
      "modalEdit": false,
      "dataGridLabel": false,
      "labelPosition": "top",
      "description": "",
      "errorLabel": "",
      "tooltip": "",
      "hideLabel": false,
      "tabindex": "",
      "disabled": false,
      "autofocus": false,
      "dbIndex": false,
      "customDefaultValue": "",
      "calculateValue": "",
      "calculateServer": false,
      "widget": {
        "type": "input"
      },
      "attributes": {},
      "validateOn": "change",
      "validate": {
        "required": false,
        "custom": "",
        "customPrivate": false,
        "strictDateValidation": false,
        "multiple": false,
        "unique": false,
        "minLength": "",
        "maxLength": "",
        "pattern": ""
      },
      "conditional": {
        "show": null,
        "when": null,
        "eq": ""
      },
      "overlay": {
        "style": "",
        "left": "",
        "top": "",
        "width": "",
        "height": ""
      },
      "allowCalculateOverride": false,
      "encrypted": false,
      "showCharCount": false,
      "showWordCount": false,
      "properties": {},
      "allowMultipleMasks": false,
      "addons": [],
      "mask": false,
      "inputType": "text",
      "inputFormat": "plain",
      "inputMask": "",
      "displayMask": "",
      "spellcheck": true,
      "truncateMultipleSpaces": false
    },
    {
      "type": "button",
      "label": "Submit",
      "key": "submit",
      "disableOnInvalid": true,
      "input": true,
      "tableView": false,
      "id": "ehenmjg",
      "placeholder": "",
      "prefix": "",
      "customClass": "",
      "suffix": "",
      "multiple": false,
      "defaultValue": null,
      "protected": false,
      "unique": false,
      "persistent": false,
      "hidden": false,
      "clearOnHide": true,
      "refreshOn": "",
      "redrawOn": "",
      "modalEdit": false,
      "dataGridLabel": true,
      "labelPosition": "top",
      "description": "",
      "errorLabel": "",
      "tooltip": "",
      "hideLabel": false,
      "tabindex": "",
      "disabled": false,
      "autofocus": false,
      "dbIndex": false,
      "customDefaultValue": "",
      "calculateValue": "",
      "calculateServer": false,
      "widget": {
        "type": "input"
      },
      "attributes": {},
      "validateOn": "change",
      "validate": {
        "required": false,
        "custom": "",
        "customPrivate": false,
        "strictDateValidation": false,
        "multiple": false,
        "unique": false
      },
      "conditional": {
        "show": null,
        "when": null,
        "eq": ""
      },
      "overlay": {
        "style": "",
        "left": "",
        "top": "",
        "width": "",
        "height": ""
      },
      "allowCalculateOverride": false,
      "encrypted": false,
      "showCharCount": false,
      "showWordCount": false,
      "properties": {},
      "allowMultipleMasks": false,
      "addons": [],
      "size": "md",
      "leftIcon": "",
      "rightIcon": "",
      "block": false,
      "action": "submit",
      "theme": "primary"
    }
  ]
}

settysreekanth avatar Oct 26 '23 23:10 settysreekanth

@settysreekanth Could you please provide how you are getting the JSON under the "Updated Schema which includes all default values:" section of your question? We do provide a "Edit JSON" button when hovering over individual components that can be clicked to show the JSON of a components. Inside this Edit JSON modal we have a checkbox that can display the full schema which can be toggled on or off. Providing a jsfiddle or code sandbox can help me better understand your issue

ZenMasterJacob20011 avatar Oct 16 '24 20:10 ZenMasterJacob20011