Skip to content

Make "Field Options" input required for type "Selectbox" #182

Open

Description

@Ruslan-Aleev

Summary

For settings with the "Selectbox" type, the "Field Options" field must be required, otherwise an empty list is displayed for the user.
And if you set only value of the field, then the logic of the list itself is lost.

list-req

Expected behavior

"Field Options" field must be required

Environment

ClientConfig 2.3

Activity

  1. Ruslan-Aleev commented on May 21, 2020

    @Ruslan-Aleev
    ContributorAuthor

    This can be solved in a crooked way, replace the name: 'options' block in the grid (https://github.com/modmore/ClientConfig/blob/master/assets/components/clientconfig/js/mgr/widgets/window.settings.js#L93) with:

    {
    xtype: 'textarea',
    id: config.id + '-options',
    name: 'options',
    fieldLabel: _('clientconfig.options') + '*',
    description: _('clientconfig.options.desc'),
    allowBlank: (config.record && (config.record.xtype === 'modx-combo')) ? false : true,
    anchor: '100%',
    hidden: (config.record && (config.record.xtype === 'modx-combo')) ? false : true,
    value: _('clientconfig.options_default')
    }
    

    And in the clientconfig.options_default lexicon set Yes==1||No==0.
    As a result, we have an example for the Selectbox for the user, which is convenient and the field is now required.
    However, for non-Selectbox, the options parameter is not empty.

    @Mark-H What do you think, should I do PR or are these corrections not particularly useful? Or is there another solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions