I wonder if we could we also make field lazy that way in context of custom form...
I find some issue with some of my custom form where I use Field() to define my field that will be use... This form is also dynamic, I manipulate field visibility and lazy_option_widget() to make some field depend of other field... The things is with data build up... requires=IS_EMPTY_OR(IS_IN_DB(_set_, 'table.id', ...)), is loading at first (on form load) all the records almost everything as I can't specify the id which will be selected in the parent field the one controlling the lazy_option controlled field (hope I am understandable)... Multiply this by 3-4 time for each lazy_option controlled field and you ends up pulling multiple time the same records... I would be interred in making the IS_IN_DB() triggered select occuring only when options needed to be displayed... I guess this is a flaw in the way lazy_option_widget() is implemented in the first place though... Richard On Sun, Mar 26, 2017 at 6:34 AM, Joe Barnhart <joe.barnh...@gmail.com> wrote: > That's kinda clever. I may think of that! > > -- Joe > > > On Thursday, March 23, 2017 at 4:19:05 PM UTC-7, Anthony wrote: >> >> Note, you might as well also add 'type': 'string' to your dictionary, and >> maybe 'length': 20. You can also give yourself some flexibility by creating >> a function: >> >> def phone_field(name, **kwargs): >> defaults = {'type': 'string', >> 'length': 20, >> 'requires': IS_EMPTY_OR(IS_PHONE()), >> 'widget': lambda fld,val: SQLFORM.widgets.string.widget( >> fld, val, _type='tel', _class='form-control')} >> defaults.update(**kwargs) >> return Field(name, **defaults) >> >> Anthony >> >> >>> -- > 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 web2py+unsubscr...@googlegroups.com. > 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.