10-12-2017 10:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-12-2017 10:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Are there recommendations for how to validate a Text Input field? There seems be a lot of "magic" wrapped up into the settings fields and I'm not certain what hooks are available to change colors or display messages of any sort.

01-23-2018 11:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2018 11:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm interested to know how anyone has implemented validation.
I would like to limit the user input to 15 characters and if possible validate using a regular expression.
If the input is invalid, how do you let the user know? Can you amend a label in the Settings page?

01-23-2018 11:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-23-2018 11:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
This is a good question. The best way that I've come up with is to include a 'status' element in the settings:
<TextInput label="Status" placeholder="Not created." settingsKey="accountStatus" disabled="true" />
You can update the text displayed therein from companion/index.js; eg:
settingsStorage.setItem('accountStatus',{'name':accountStatusMsg});
However, I've found that the element doesn't word-wrap, so I have to limit status messages to about 35 characters. The lack of dynamic word-wrapping kinda seems like a bug.
Gondwana Software
01-23-2018 13:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

01-23-2018 13:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks @Gondwana
Do you have to load the value the next time the companion loads or does the <TextInput> load the value from settingsStorage itself?

01-23-2018 16:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


01-23-2018 16:16
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
To my experience, once the text is stored in the setting, it will stick. The TextInput will grab it automatically in future.
Gondwana Software

