Checkboxes are shown without space between checkbox and label

44 views
Skip to first unread message

João Matos

unread,
Mar 20, 2019, 5:30:08 AM3/20/19
to web2py-users
Hello,

When creating a SQLFORM with checkboxes, they are shown without a space between the checkbox and the label.
The correct behavior would be to have a space, like it happens with the Delete checkbox on
record edit.

This is how it looks


Checkboxes.png


This is my code

    ...
            field
= Field(
                opt_cat
.name_en.translate(''.maketrans(*translation_table)).replace(
                   
'__', '_').replace('__', '_').lower(),
                widget
=SQLFORM.widgets.checkboxes.widget,
                requires
=IS_EMPTY_OR(IS_IN_SET(rows_dic)),
           
)

           
if T.accepted_language == 'pt':
                field
.label = opt_cat.name
           
else:
                field
.label = opt_cat.name_en

            factory_fields
.append(field)

    form
= SQLFORM.factory(*factory_fields,
        buttons
=[BUTTON(T('Submit'), _type='submit', _class='btn btn-primary')],
   
)






If even tried replacing

                opt_cat.name_en.translate(''.maketrans(*translation_table)).replace(
                   
'__', '_').replace('__', '_').lower(),


with a simple string, but with the same result.


Windows 7 Pro x64 SP1+all updates
web2py 2.18.4
Firefox 65.0.2 x64
Python 3.71. x86

Thanks,

JM

jcrm...@gmail.com

unread,
May 3, 2019, 8:18:07 AM5/3/19
to web2py-users
Found a kludge.

        # Fix the lack of space between the checkbox and the label.
       
# The ' ' below is not a space but chr(255).
        rows_lst
= [(key, ' ' + value) for key, value in rows_lst]


Reply all
Reply to author
Forward
0 new messages