简体   繁体   中英

How to Hide/Show a text field in titanium alloy?

Is there any way to show/hide the text field based on the selected input. I have one radio button question is there If user select Other option from that question then I need to display one textbox to enter the value. Is it possible.

View

<TextField id="locationText" hintText="Enter Reason"></TextField>

Style:

"#locationText": {
    width: '90%',
    top: '25dp',
    height: 40
}

Controller:

button.addEventListener('singletap', function(e) {
      if(radioGroup.selectedValue == 'Other')
       {
        // Here I need to show the text field, If the selected value is not Other the text field should be hidden
       }
});

Any suggestions please

View :

<TextField id="locationText" visible=false hintText="Enter Reason"></TextField>

Controller :

button.addEventListener('singletap', function(e) {
    if(radioGroup.selectedValue == 'Other'){ 
        $.locationText.visible = true;        
    }else{
        $.locationText.visible = false;
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM