Multiple selection dropdown widget, UI

92 views
Skip to first unread message

Ron Chatterjee

unread,
Apr 24, 2016, 5:16:36 PM4/24/16
to web2py-users
 duration_str = ('Month or less', '6 months', '1 year')

Field('duration', type='list:string',requires=IS_IN_SET((duration_str), multiple=True),widget=lambda field, value: SQLFORM.widgets.multiple.widget(field, value, size=3, style='divs', label=True)),

This create a multiple selection but the UI is very generic. Wondering if any widget will give me an UI similar to the link below (explained in pic) with tags?

http://semantic-ui.com/modules/dropdown.html

See section
"Multiple Selection

A selection dropdown can allow multiple selections

"



drop_down.png

Ron Chatterjee

unread,
Apr 25, 2016, 10:11:26 AM4/25/16
to web2py-users
I guess, I can do something similar to this:


But doesn't do multiple selection.

Ron Chatterjee

unread,
Apr 25, 2016, 12:00:15 PM4/25/16
to web2py-users
I guess this is all I had to do.



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    rel="stylesheet" type="text/css" />
    rel="stylesheet" type="text/css" />
    type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $('#Project_duration').multiselect({
            includeSelectAllOption: true
        });
    });
</script>

It works! 

Carlos Zenteno

unread,
Apr 25, 2016, 7:53:13 PM4/25/16
to web2py-users
Thank for asking and answering yourself. I am sure somebody will find it useful.

Carlos Zenteno

unread,
Apr 25, 2016, 7:55:01 PM4/25/16
to web2py-users
Reply all
Reply to author
Forward
0 new messages