Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
4199 Tampilan

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?

Avatar
Buang
Jawaban Terbai

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


Avatar
Buang
Penulis

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

Penulis Jawaban Terbai

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

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Mar 23
9772
2
Mar 23
2233
0
Mar 22
1484
1
Mei 21
4196
1
Sep 20
3443