Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
4201 Lượt xem

Hi,

I have button, and I want to make it disabled after code execution:

="object"  class="btn-primary"

Is it possible to change class and append `disabled` after clicking button in call_function?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

adding class through js, write an onclick function for that particular button and write similar code inside it

var element = document. getElementById('#button_id');

element. classList. add('disabled');


Ảnh đại diện
Huỷ bỏ
Tác giả

is it possible to change class, from python code? in method `call_function` itself, after button is pressed?

Tác giả Câu trả lời hay nhất

One way to do this is:

Have a Binary field: is_button_enabled

Have 2 identical buttons is view display, like:


with atrs: invisible and check is_button_enabled field for button1 and button2

attrs="{'invisible': [('is_button_enabled', '=', False)]}

and

attrs="{'invisible': [('is_button_enabled', '=', True)]}

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 23
9772
2
thg 3 23
2234
0
thg 3 22
1485
1
thg 5 21
4198
1
thg 9 20
3445