How to disable edit_line [closed]

2019-08-07 01:56发布

I would like to disable a text input field (edit_line in Shoes) for user edition(grey field). I want to have possibility to e.g. set text but I dont want to give that possibility to users. I checked manual but there's nothing about that edit_line, only basics.

2条回答
男人必须洒脱
2楼-- · 2019-08-07 02:02

Above answers are perfectly valid! But incase you want to toggle between enabled and disabled state after the edit_line object is created, you can use:

@line = edit_line
@line.state = "disabled" #Disables @line
@line.state = "enabled" #Enables @line back!
查看更多
\"骚年 ilove
3楼-- · 2019-08-07 02:17

As answered in the comments session, to disable edit_line you need to pass a state option:
edit_line(state: "disabled")

查看更多
登录 后发表回答