Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
3988 มุมมอง

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
9564
Cacher le bouton "créer" d'une liste แก้ไขแล้ว
2
มี.ค. 23
2008
0
มี.ค. 22
1343
1
พ.ค. 21
3997
Dynamically Hide Button based on Groups แก้ไขแล้ว
1
ก.ย. 20
3289