-
Notifications
You must be signed in to change notification settings - Fork 27
feat(CheckboxGroup): add support for required field #1131
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
Conversation
rohanm-crest
commented
Apr 10, 2024
- Implemented a new checkboxgroup component named "Required checkbox example" with required validation.
- Updated "schema.json" and "valid_config.json" to include the "required" attribute.
- Addressed the issue where the "required" validation was not functioning correctly when only a single field was present in the form.
CLA Assistant Lite bot CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the Code of Conduct and I hereby accept the Terms |
@artemrys you remember I complained the bot sends only one message at the time? The bot asked about COC and the check passed, but CLA check did not. Because it did not asked about it. upd: seems like this github action is not supposed to be used as parallel jobs. It looks for it's own comment and updates it. upd2: raised an issue: splunk/addonfactory-github-workflows#59 |
@rohanm-crest could you also sign https://github.com/splunk/cla-agreement/blob/main/CLA.md by commenting here
|
@@ -975,7 +975,8 @@ | |||
} | |||
] | |||
} | |||
} | |||
}, | |||
"required" : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"required" : true | |
"required" : { | |
"type": "boolean" | |
} |
it should describe that possible value type for field required
is boolean (true or false).
Reference: https://json-schema.org/learn/getting-started-step-by-step#properties
ui/src/components/BaseFormView.tsx
Outdated
@@ -944,7 +944,7 @@ class BaseFormView extends PureComponent<BaseFormProps, BaseFormState> { | |||
) => { | |||
const index = this.entities?.findIndex((x) => x.field === field); | |||
const validator = [{ type: 'custom', validatorFunc }]; | |||
if (index && this.entities?.[index]) { | |||
if (index!=undefined && this.entities?.[index]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, nice catch.
just to double check with @soleksy-splunk, what do you think?
and please pay attention to correct PR title. it should be like technically, it is adding new feature since we unlock possibility to use required validation. Adding something to storybook accompanies that feature, allowing us to test it easily |
082ea2a
to
ca87932
Compare
I have read the CLA Document and I hereby accept the CLA |