تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
4404 أدوات العرض

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
مارس 23
10031
2
مارس 23
2441
0
مارس 22
1583
1
مايو 21
4369
1
سبتمبر 20
3548