I’m writing a Mattermost plugin which can receive a variable from setting page in
System Console / PLUGINS (BETA) / plugin_name
A value check will be performed when user input some parameters and click Save.
And if the value check found that there’s illegal characters, I want to popup a message immediately.
Found a similar function in the
System Console / AUTHENTICATION / password
there is a minimum password length setting can lead to an error message displayed alongside the Save button like below:
Any ideas how to show that error message?
The password setting is one of our built-in settings for the Admin Console that includes that specific validation.
However, if you need to add your specific validation check you can create a custom admin setting component for your plugin where it can validate the input and show error messages when needed. You can find more details here.
You can define your component as desired, for example, listening to the
OnChange event to look for illegal characters to open a popup with a message as you suggested, or maybe not allowing to input those characters at all or show an error message within the component. It is open to be implemented as needed and it can control when to enable the
Save button when the setting value is valid to save.
This is available starting in version 5.18. Let me know if you have any questions. You can also ping us at the Toolkit channel in the community server.