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

How to make a text input depend on value of select in settings?

Hi, I have a selection in the settings index.jsx, and I want the URL text input to only be available when the third selection option is chosen (option C).

 

Here is my relevant code:

 <Select 
          settingsKey="SourceSelect"
            label="Data Source"
            options={[
             {name:"a"},
             {name:"b"},
             {name:"c"}
             ]}
          /> 
        
          
         <TextInput
          settingsKey="URL"
          label="Enter URL"
          defaultValue="http://127.0.0.1"
        />
       

Any help appreciated.

 

Thanks!

Best Answer
0 Votes
1 REPLY 1

I tried the following but the text remains unclickable no matter which option is selected:

 

<TextInput
          settingsKey="URL"
          label="Enter URL"
          defaultValue="http://127.0.0.1"
          disabled={!(props.settings.SourceSelect === "c")}
        />  

 

Best Answer
0 Votes