Do you really need a class?
You can create widget as a simple function as shown in the book. I say that
because it easier to show you how to set default value with a simple
function (less code)...
def mysupercustomwidget(field, value, ...)
...
if value is not None and value != '':
field_value = value
INPUT(..., value=field_value)
...
Hope it helps.
Richard
On Tue, Mar 11, 2014 at 10:14 AM, Thomas Bellembois <
[email protected]> wrote:
> Dear web2py community,
>
> I have build my own widget like:
>
> class CHIMITHEQUE_MULTIPLE_widget(object):
>
> def __init__(self, ..., **attributes):
> ...
>
> def __call__(self, field, value):
> ...
> # build the widget and populate with the value parameter if not
> Null
> ...
> return DIV(...)
>
> I have no problems except for the validate(keepvalues=True) feature, my
> widget is not populated. Actually no value is passed to the __call__
> function.
>
> While updating a database item, the widget populates properly.
>
> I do not know how exactly keepvalues works, so I may have missed
> something.
>
> Any idea ?
>
> Regards,
>
> Thomas
>
>
>
> --
> 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.