If you want to avoid javascript magic, you'll want to create a custom
widget, probably something extending a dropdown. However, there are nice
lightweight js libraries for adding images to dropdown options.
On Tuesday, 9 January 2018 12:33:07 UTC, Dragan Matic wrote:
>
> I would like to have an icon or image picker in form where user could
> choose from a set of predefined icons.
> Form would contain a few other fields like a title, text and an icon that
> would visually mark the topic of the text. Icons could be either pictures
> in 'static' folder or in 'uploads' (site admin would preload a few icons in
> a table, something like 'text_topic_symbols' or something similar).
>
> I've tried doing something like this:
>
> db.define_table('topic_icon',
> Field('topic_icon_image', 'upload'))
>
> db.define_table('content',
> Field('title', 'string', length=256, required=True),
> Field('body', 'text', required=True),
> Field('topic_type', 'reference topic_icon'))
>
>
>
> But then I don'k know how to build a FORM that would show image picker.
>
> Would it be possible to do with web2py or I have to use some javascript
> magic?
>
--
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.