Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

combining textinput and select

ANSWERED

Hi community,

 

I have a Select statement from where a user can select  one out of several options.

<Select
        settingsKey="myAppLaunch"
           label={`Selection`}
           options={[
            {name: 'No app',   value: 'Nothing'},
            {name: 'Agenda',   value: '9646a9da-fdef-47ba-81a2-a1f6f82c101c'},
            {name: 'Weather',  value: '000013fe-0000-4000-8000-000000f17b17'},
            {name: 'Timer',    value: '000013ed-0000-4000-8000-000000f17b17'},
            {name: 'Music',    value: '000013f6-0000-4000-8000-000000f17b17'},
            {name: 'Alarms',   value: '000013f1-0000-4000-8000-000000f17b17'},
            {name: 'Spotify',  value: 'dc411695-8f1e-4643-9881-b19d053fbc33'},
            {name: 'Select your own app',  value:  'Custom'}                     
          ]}
Only if the user selects the last option {name: 'Select your own app',  value:  'Custom'}      I want a textinput to popup so the user can fill in the necessary value.
 
Anyone got an idea?
 
Kinds regards, 
 
Robert
Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

This is tricky but probably possible (so long as you're not too fussy about what you mean by 'popup').

 

Have a look at the toggle code here. It shows how a setting can be shown or hidden depending on the value of some other setting.

 

It might be possible to connect that directly to the setting of your <Select> (by accessing the value within the setting object). However, if that doesn't work or is too unreadable, you could use the onSelection attribute of your <Select> to set some other simple setting (it could be just a boolean, and doesn't need to directly correspond to any setting element); eg, 'custom'. Then, make the display of the TextInput conditional on that.

Peter McLennan
Gondwana Software

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

This is tricky but probably possible (so long as you're not too fussy about what you mean by 'popup').

 

Have a look at the toggle code here. It shows how a setting can be shown or hidden depending on the value of some other setting.

 

It might be possible to connect that directly to the setting of your <Select> (by accessing the value within the setting object). However, if that doesn't work or is too unreadable, you could use the onSelection attribute of your <Select> to set some other simple setting (it could be just a boolean, and doesn't need to directly correspond to any setting element); eg, 'custom'. Then, make the display of the TextInput conditional on that.

Peter McLennan
Gondwana Software
Best Answer
0 Votes

Thanks i used the onSelect and it worked. I tried such thing before but didn't understand the synataxis of ReactJS but now I understand.

 

Thnx!

Best Answer