10-20-2020 05:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-20-2020 05:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
On my Settings page, I need to update a TextInput label when a user selects an option from a Select component. I want to do this from the Select onSelection event. Is there a way to reference the TextInput component from the Select component (both are on the Settings page)?
Answered! Go to the Best Answer.

Accepted Solutions
10-20-2020 12:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-20-2020 12:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't know, but if it's possible, you may need to think in terms of React rather than how you'd do it in an HTML+JS web page.
I'd experiment with making the TextInput label depend on a setting; something like (but almost certainly not)
label={props.settingsStorage.getItem('desiredLabelSettingKey')}
The, in onSelection, try something like (but almost certainly not)
props.settingsStorage.setItem('desiredLabelSettingKey', 'New label')
Gondwana Software

10-20-2020 12:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-20-2020 12:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I don't know, but if it's possible, you may need to think in terms of React rather than how you'd do it in an HTML+JS web page.
I'd experiment with making the TextInput label depend on a setting; something like (but almost certainly not)
label={props.settingsStorage.getItem('desiredLabelSettingKey')}
The, in onSelection, try something like (but almost certainly not)
props.settingsStorage.setItem('desiredLabelSettingKey', 'New label')
Gondwana Software

10-21-2020 09:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-21-2020 09:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thanks for the suggestions, I got it to work using the following code:
SELECT COMPONENT
onSelection={(selection) => {
let format = selection.values[0].value;
if ( format === constants.FORMAT_X ) {
props.settingsStorage.setItem('formatKey', JSON.stringify({'name': 'Data X'}));
} else if ( format === constants.FORMAT_Y ) {
props.settingsStorage.setItem('formatKey', JSON.stringify({'name': 'Data Y'}));
} else {
props.settingsStorage.setItem('formatKey', JSON.stringify({'name': 'Data Default'}));
}
}}
TEXTINPUT COMPONENT
label={
(typeof props.settings.format === constants.UNDEFINED ) ? "Default Txt" : JSON.parse(props.settingsStorage.getItem('formatKey')).name
}
