field-level validation in settings
@EduardMe is already working on this.
Since Jan 25, 2022.
- Dominant language
- JavaScript
- Stars
- 204
- Forks
- 82
- Avg merge
- 22h 27m
- Merged PRs (30d)
- 3
Description
in plugin.json > settings, define an (optional) validation function that will get called for each field in the settings, with a signature like:
onConfigFieldValidate(fieldName: string, fieldValue: string | number | ... ): string
The validation function will return an empty string '' if validation passes, or an error message to be displayed (e.g. in red under the field) if it does not pass.
The only tricky bit is when to call the validation function. Feels like the ideal is to do all of:
a) on settings load (when the settings window is brought up)
b) on blur (when someone has entered and left a field)
c) on "Save and close" click (errors would cancel the close)
More discussion here:
https://discord.com/channels/@me/928678751808671865/935560749823164486
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.