The issue could be simply solved by using css.

For example by adding the below code in your css file:

        .web2py_checkboxeswidget.horizontal {
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
        }
        
        .web2py_checkboxeswidget.horizontal > div {
            margin-right: 3px;
            display: inline-block;
        }

and  by adding the class "horizontal" to the web2py checkboxes widget

db.define_table('mytable',
                Field('name', type='list:string',requires=IS_IN_SET 
(('True','False', 'Neither'), multiple=True),
                      widget=lambda field, value: 
SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True, 
_class="horizontal")))


Il giorno venerdì 15 gennaio 2016 21:16:38 UTC+1, Ron Chatterjee ha scritto:
>
> I couldn't get those plug in to work. There should be a way to render the 
> form horizontally. I am surprised there there isnt! Checked with Django 
> site. I can run that with one line  renderer=HorizontalCheckboxRenderer. 
> Arn't we suppose to be the best!? lol
>
>
>
> On Thursday, January 14, 2016 at 3:19:28 PM UTC-5, Richard wrote:
>>
>> There were widget plugins also for that : 
>> https://github.com/scubism/sqlabs
>>
>> But these are really really old, and repo not have been update since 3 
>> years...
>>
>> The demo site seems not available any more...
>>
>> Richard
>>
>> On Thu, Jan 14, 2016 at 3:12 PM, Ron Chatterjee <[email protected]> 
>> wrote:
>>
>>> I have it like this:
>>>
>>>
>>> db.define_table('mytable',
>>>                 Field('name', type='list:string',requires=IS_IN_SET 
>>> (('True','False', 'Neither'), multiple=True),
>>>                       widget=lambda field, value: 
>>> SQLFORM.widgets.checkboxes.widget(field, value, style='divs', label=True)))
>>>
>>>
>>>
>>> That gives me vertical placement. But you are right. That's the way to 
>>> do it.
>>>
>>>  
>>>
>>> On Thursday, January 14, 2016 at 1:40:25 PM UTC-5, Richard wrote:
>>>>
>>>> Looks about style parameters of SQLFORM.widget.checkbox there is 
>>>> information about that if I remember... There is also _style attribute 
>>>> where you can use 'divs'. Make sure you read about both attributes they 
>>>> are 
>>>> differents and serve differents purposes...
>>>>
>>>> But with _style='divs' you should be able to displays everythings at 
>>>> you which with CSS...
>>>>
>>>> Richard
>>>>
>>>> On Thu, Jan 14, 2016 at 1:23 PM, Ron Chatterjee <[email protected]> 
>>>> wrote:
>>>>
>>>>> It does! Thank you Richard. Do you happen to know if I want to display 
>>>>> the checkbox horizontally as oppose to vertically, how would I do that? I 
>>>>> asked cuz if I have a table with other fields and I have 10 checkboxes to 
>>>>> say, it will be better to present them horizontally than vertically. 
>>>>> Regardless, thanks for your time on this. Appreciated.
>>>>>
>>>>>  
>>>>>
>>>>> On Thursday, January 14, 2016 at 12:33:52 PM UTC-5, Richard wrote:
>>>>>>
>>>>>> multiple=True in IS_IN_SET() validator should help...
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>> On Thu, Jan 14, 2016 at 11:57 AM, Ron Chatterjee <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Where in the book I find this info?  
>>>>>>>
>>>>>>>
>>>>>>> On Thursday, January 14, 2016 at 11:56:51 AM UTC-5, Ron Chatterjee 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Here is an example in picture.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wednesday, January 13, 2016 at 4:23:11 PM UTC-5, Ron Chatterjee 
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> *Model:*
>>>>>>>>>
>>>>>>>>> db.define_table('mytable',
>>>>>>>>>                 Field('name', 
>>>>>>>>> type='list:string',requires=IS_IN_SET (('True','False')),
>>>>>>>>>                       widget=SQLFORM.widgets.checkboxes.widget))
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *Controller:*
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> def index():
>>>>>>>>>     variables = []
>>>>>>>>>     form = SQLFORM(db.mytable).process()
>>>>>>>>>     if form.accepted:
>>>>>>>>>         #comments from that particular blog post
>>>>>>>>>         variables = form.vars.name
>>>>>>>>>     return dict(form = form,variables = variables )
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> *View:*
>>>>>>>>>
>>>>>>>>> {{extend 'layout.html'}}
>>>>>>>>> {{=form}}
>>>>>>>>> {{=variables}}
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I can only output true or false. I want to select and output True 
>>>>>>>>> and False both. How?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>> Resources:
>>>>>>> - http://web2py.com
>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>> --- 
>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>> Groups "web2py-users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>> send an email to [email protected].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://github.com/web2py/web2py (Source code)
>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "web2py-users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to [email protected].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> -- 
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to