Skip to content
This repository has been archived by the owner on May 11, 2023. It is now read-only.

[QUESTION] Can I add new keys to components? #451

Open
sofiaisreis opened this issue Jun 2, 2020 · 1 comment
Open

[QUESTION] Can I add new keys to components? #451

sofiaisreis opened this issue Jun 2, 2020 · 1 comment

Comments

@sofiaisreis
Copy link

Hello, I am trying to add to specific things, in a component.
1 - First, on the values, besides 'Label' and 'Value': The value needs to be a number, not a string. Also, I need to have two fields such as 'NA', and 'Set to 0' (the second one will force the value of that row to be always 0).
2 - Secondly, I would like to add a weight option (numeric), below "Values".

exformio

The image above illustrates what I want to do. However I tried but couldn't figure out how to do it.
I'm using the builder with the angular framework, and typescript instead of javascript.
I'm using formoptions to acess and edit wich values I want to ignore or use, but how can I add new custom ones?

This is part of my html:

       <form-builder [form]="form" id="formBuilder" (change)="onChange($event) 
      [options]="formOptions"  [editForm]="editForm">
        </form-builder>

And my typescript code, to edit the radio component modal is:

this.formOptions = {
  editForm: {
    radio: [
          {
            key: 'display',
            ignore: 'false',
            components:
              [
                {
                  key: 'labelPosition',
                  ignore: true
                },
                {
                  key: 'optionsLabelPosition',
                  ignore: true
                },
                {
                  key: 'description',
                  ignore: true
                },
                {
                  key: 'customClass',
                  ignore: true
                },
                {
                  key: 'tabindex',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'hidden',
                  ignore: true
                },
                {
                  key: 'hideLabel',
                  ignore: true
                },
                {
                  key: 'autofocus',
                  ignore: true
                },
                {
                  key: 'disabled',
                  ignore: true
                },
                {
                  key: 'tableView',
                  ignore: true
                },
                {
                  key: 'modalEdit',
                  ignore: true
                },
                {
                  key: 'customDefaultValue',
                  ignore: true
                }
              ]
          },
          {
            key: 'data',
            ignore: false,
            components:
              [
                {
                  key: 'values',
                  ignore: false,
                  components:
                    [
                      {
                        key: 'shortcut',
                        ignore: true
                      }
                    ]
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'persistent',
                  ignore: true
                },
                {
                  key: 'protected',
                  ignore: true
                },
                {
                  key: 'dbIndex',
                  ignore: true
                },
                {
                  key: 'encrypted',
                  ignore: true
                },
                {
                  key: 'redrawOn',
                  ignore: true
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'clearOnHide',
                  ignore: true
                },
                {
                  key: 'customDefault',
                  ignore: true
                }, {
                  key: 'customDefaultValue',
                  ignore: true
                },
                {
                  key: 'calculateValue',
                  ignore: true
                },
                {
                  key: 'calculateServer',
                  ignore: true
                },
                {
                  key: 'allowManualOverride',
                  ignore: true
                },
                {
                  key: 'dataType',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'allowCalculateOverride',
                  ignore: true
                },
                {
                  key: 'defaultValueComponent',
                  ignore: true
                }
              ]
          },
          {
            key: 'layout',
            ignore: true
          },
          {
            key: 'conditional',
            ignore: true
          },
          {
            key: 'api',
            ignore: true
          },
          {
            key: 'logic',
            ignore: true
          },
          {
            key: 'validation',
            ignore: true
          }
        ]
  }
}
@cmcortez
Copy link

Hello @sofiaisreis we would be happy to help you review this code as part of a support package. If you are interested in going down this road please write to support@form.io and I can discuss the options we have in place.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants