Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ruslan-Aleev opened this issue May 8, 2020 · 1 comment
Open

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

Ruslan-Aleev opened this issue May 8, 2020 · 1 comment

Comments

@Ruslan-Aleev
Copy link
Contributor

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

@Ruslan-Aleev
Copy link
Contributor Author

Ruslan-Aleev commented May 21, 2020

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant