Ok thanks for your reply. That makes sense.

Matt

On Apr 12, 4:13 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> No. This is correct. If you had
>
> "1|2|11" in the field how would you write a sql query to seach for
> "1"?
>
> If you have "|1|2|11|" you can look for LIKE '%|1|%' and there is no
> ambiguity.
>
> Massimo
>
> On Apr 11, 10:57 pm, Matt <mjwat...@gmail.com> wrote:
>
> > Also if I choose both values in the select you get:
>
> > Accepted Variables
> > locations       :       |1|2|
>
> > Whereas I would have expected it to be:
>
> > Accepted Variables
> > locations       :       1|2
>
> > Looking at validators.py lines 297/8
>
> >         if self.multiple:
> >             return ('|%s|' % '|'.join(values), None)
>
> > Shouldn't that be?
>
> >         if self.multiple:
> >             return ('%s' % '|'.join(values), None)
>
> > Matt
>
> > On Apr 11, 12:38 pm, Matt <mjwat...@gmail.com> wrote:
>
> > > Hi there,
>
> > > I'm attempting validate a multiple select against a set of values.
> > > I.e.
>
> > > def test():
> > >     form = FORM(INPUT(_name='title', requires=IS_NOT_EMPTY()),
> > >                 SELECT([1,2], _name='locations', _multiple='multiple',
> > > requires=IS_IN_SET([1,2], multiple=True, error_message='Please select
> > > several locations')),
> > >                 INPUT(_type='submit', _value='Save'))
>
> > >    if form.accepts(request.vars, session):
> > >         session.flash="Valid"
>
> > >    return dict(form=form)
>
> > > In test.html:
>
> > > {{= form }}
>
> > > <h2>Submitted variables</h2>
>
> > > {{= BEAUTIFY(request.vars) }}
>
> > > <h2>Accepted Variables</h2>
>
> > > {{= BEAUTIFY(form.vars) }}
>
> > > <h2>Errors in form</h2>
>
> > > {{= BEAUTIFY(form.errors) }}
>
> > > when I submit the form with _no entries or selections_ I get:
>
> > > Submitted variables
> > > title   :
> > > Accepted Variables
> > > locations       :       ||              <---- This is wrong. I must 
> > > provide a value from the
> > > set.
> > > title   :
> > > Errors in form
> > > title   :       enter a value
>
> > > Is this possibly a bug or I am doing something wrong here?
> > > Matt


-- 
To unsubscribe, reply using "remove me" as the subject.

Reply via email to