formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

[Suggestion] Make Questions value from Survey required

Open Justinlcx opened this issue 8 months ago • 2 comments

Is your feature request related to a problem? Please describe. In the current state, users can add a survey with empty questions and values. This is prone to user error and results in a UI that doesn't look good.

Image

Describe the solution you'd like Make the value for the question required, just like the Data Value in select boxes or radio components.

Image

Describe alternatives you've considered I could overwrite the current survey component, but I'd prefer not to.

Additional context

The fix seems straightforward, but I'm not sure if it's what was intended to be this way.

    type: 'datagrid',
    input: true,
    label: 'Questions',
    key: 'questions',
    tooltip: 'The questions you would like to ask in this survey question.',
    weight: 0,
    reorder: true,
    defaultValue: [{ label: '', value: '' }],
    components: [
      {
        label: 'Label',
        key: 'label',
        input: true,
        type: 'textfield'
      },
      {
        label: 'Value',
        key: 'value',
        input: true,
        type: 'textfield',
        allowCalculateOverride: true,
        calculateValue: { _camelCase: [{ var: 'row.label' }] },
        validate: {
          'required': true
        },
      },
      {
        label: 'Tooltip',
        key: 'tooltip',
        input: true,
        type: 'textfield',
      },
    ]

Justinlcx avatar Apr 10 '25 20:04 Justinlcx

@Justinlcx Thank you for suggesting an improvement. I have logged a ticket for the backlog. We are always willing to review any contributions to resolve this issue from the open source community.

For internal reference: FIO-10025

olgabann avatar Apr 16 '25 13:04 olgabann

After review, we don't expect to resource this ourselves but are willing to review any contributions to add this.

lane-formio avatar Apr 17 '25 15:04 lane-formio