The default validator for a reference field is IS_EMPTY_OR(IS_IN_DB(...)). 
When SQLFORM encounters a field without an explicit "widget" specified but 
with an IS_IN_SET or IS_IN_DB validator, it automatically generates a 
select widget with options derived from the validator.

In your case, you have replaced the default validator with your own, so you 
no longer get the default select widget.

Instead, try just use an IS_IN_DB() validator, which will require the 
selection of a value.

Anthony

On Sunday, May 19, 2019 at 1:38:10 AM UTC-4, Vlad wrote:
>
> In the following table - 
>
> db.define_table('products_group_content',
>     Field('products_group','reference 
> products_group',requires=[IS_NOT_EMPTY()]),
>     Field('product','reference product'),
>     auth.signature)
>
> when I add a record (using grid functionality or in the admin interface) - 
> the products_group field doesn't have a drop box with a list of groups (it 
> has a regular text edit field), even though this field is referencing 
> another table. 
> on the other hand, the product field does have a drop box with a list of 
> products to pick from. 
>
> Why the difference? Seems to me, in both cases the drop box should be in 
> place. I have no clue why requires parameter makes any difference at all. 
> What am I missing?? 
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/935daab8-e037-4583-a08b-df03e7f47997%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to