Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
4421 Представления

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?

Аватар
Отменить
Лучший ответ

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');


Аватар
Отменить
Автор

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

Автор Лучший ответ

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)]}

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
мар. 23
10043
2
мар. 23
2451
0
мар. 22
1593
1
мая 21
4382
1
сент. 20
3564