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

Hello Guys. Can some help with how to do checkboxes but the options are added through a selection field or can be added manually... and only one should be selected at a time.

I need both the python code and xml for view.

Thanks...


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

Thanks, Waleed Mohsen, Am going to use radio buttons however much, How can I organize the radio buttons like putting three per row...

Câu trả lời hay nhất

You will use radio widget:

Add field in py:

type = fields.Selection(string='Type', selection=[('A', 'A'), ('B', 'B')])

in XML View,

<field name="type" widget="radio" >

If you want the radio boxes to show horizontally you will add options="{'horizontal': true}" 

<field name="type" widget="radio"  options="{'horizontal': true}"/>

 

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 19
2955
2
thg 12 23
14011
0
thg 11 23
1267
0
thg 10 23
33
3
thg 10 23
788