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