On Tuesday, October 13, 2015 at 12:21:10 PM UTC-4, John Smidt wrote:
>
> Ok, I get how the IS_IN_SET needs a filtered set as the first argument but 
> now I'm not sure how to get the current_collection_id? This is all dealing 
> with a SQLFORM.grid and my .requires statement is in my model so how do I 
> get the id of the collection that was selected from the grid into my model 
> for the filter?
>

First, no reason not to use IS_IN_DB -- it is designed for this purpose.

Regarding the current collection ID, you can just set the validator within 
your controller (after you get the current ID) -- the "requires" attribute 
of a field can be changed at any time before the actual validation happens. 
Another option is to get it from request.vars (if the current request 
doesn't involve the controller action in question, then the value will 
simply be None).

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.

Reply via email to