Re: [web2py] Re: multiselect with part of a table

2011-08-05 Thread Nicolas Palumbo
I fixed it with a custom validator as howesc suggested.Basically i added a second set parameter which has the selected items of other products, without changing the items that the widget will use, but affecting the final values variable used for persistence: class CUSTOM_IS_IN_DB(Validator): de

Re: [web2py] Re: multiselect with part of a table

2011-08-02 Thread Nicolas Palumbo
yes, shouldn't be "what already exists in db" because that may include items of the actual selection. DOing the multiselect only useful for adding stuff... but the actual selection + what was already selected from the other products. I'll see if I find a way to do that. Thanks, Nico On Sat, Jul 3

Re: [web2py] Re: multiselect with part of a table

2011-07-30 Thread howesc
sounds like you would need to write either a custom validator and or some custom handling of the form - the SQLFORM() helper assumes that what is the output of the validated field is exactly what you want to store in the DB, but it sounds like you want the output of the validated field to be mad

Re: [web2py] Re: multiselect with part of a table

2011-07-29 Thread Nicolas Palumbo
Please is theare any chance to do this? without having to go for the 3 tables apporach? To remind you all: I have a multiselect like this one: db.py: db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda r: '%s %s' %(db.application[r

Re: [web2py] Re: multiselect with part of a table

2011-07-27 Thread Nicolas Palumbo
any ideas?

Re: [web2py] Re: multiselect with part of a table

2011-07-26 Thread Nicolas Palumbo
I'm currently having a problem with this validation: db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product), 'instance.id',db.instance._format,multiple=True) If the user changes the profile to other product and susbscribe to instances shown for that product, the p

Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
works perfect. Thanks!

Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Anthony
On Friday, July 15, 2011 12:27:19 PM UTC-4, Anthony wrote: > > The table format string/function should be stored in its ._format > attribute, so you might also be able to do: > > db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product), > > 'instance.id',db.ins

Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Anthony
The table format string/function should be stored in its ._format attribute, so you might also be able to do: db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product), 'instance.id',db.instance._format,multiple=True) Maybe that should actually be the default

Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
I fixed it like this: db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'instance.id',lambda r: '%s %s' % (db.application[r.app].name,db.server[r.server].hostname),multiple=True) On Fri, Jul 15, 2011 at 2:52 PM, Nicolas Palumbo wrote: > Although this i

Re: [web2py] Re: multiselect with part of a table

2011-07-15 Thread Nicolas Palumbo
Although this is working: db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==auth.user.product),'instance.id',multiple=True) Is only showing ids , disregarding of the format defined here: db.define_table('instance',Field('app',db.application),Field('server',db.server),Fiel

[web2py] Re: multiselect with part of a table

2011-07-14 Thread Anthony
The default validator for a list:reference field is IS_IN_DB(db,'.id',multiple=True). Instead of db, you can pass a DAL Set to that validator to filter the returned list -- something like: db.audienceInstances.instances.requires=IS_IN_DB(db(db.instance.type==current_profile.type),'instance.id',

[web2py] Re: multiselect with part of a table

2011-07-14 Thread Nicolas Palumbo
any alternatives? On Wed, Jul 13, 2011 at 3:39 PM, Nicolas Palumbo wrote: > I have currently this multiselect generated by list:references: > > db.py: > > db.define_table('instance',Field('app',db.application),Field('server',db.server),Field('type','string'),format=lambda > r: '%s %s' %(db.applic