Definitively a problem with the widget. Please open a ticket about it.

On Saturday, 15 September 2012 17:01:44 UTC-5, mweissen wrote:
>
> Sorry, I did not mention: 
> I did not use a form, I have used the admin interface to insert and update 
> the records.
> I have tried it twice: first with my "real" program and second with the 
> small program I have sent.
>
> Now I have added this function:
>
> def em():
>     form=SQLFORM(db.address)
>     if form.process().accepted:
>         response.flash='ok'
>     elif form.errors:
>         print form.errors
>     return dict(form=form)    
>
> ... and used it to add two wrong email-addresses:
> aa
> bb
>
> I did not get an error messege below the fields, but the flash "Errors in 
> form, please check it out" and both fileds look like 
> ['aa', 'bb']
>
>
> 2012/9/15 Massimo Di Pierro <massimo....@gmail.com <javascript:>>
>
>> I cannot reproduce this:
>>
>> >>> IS_EMAIL()('x')
>> ('x', 'enter a valid email address')
>> >>> IS_EMAIL()('x...@x.com <javascript:>')
>> ('x...@x.com <javascript:>', None)
>> >>> IS_LIST_OF(IS_EMAIL())(['x'])
>> (['x'], 'enter a valid email address')
>> >>> IS_LIST_OF(IS_EMAIL())(['x...@x.com <javascript:>'])
>> (['x...@x.com <javascript:>'], None)
>> >>> IS_LIST_OF(IS_EMAIL())(['x#x.com'])
>> (['x#x.com'], 'enter a valid email address')
>>
>> can your print form.errors? Perhaps this is a problem with the widget and 
>> not the validator.
>>
>> On Saturday, 15 September 2012 13:08:50 UTC-5, mweissen wrote:
>>
>>> I have a simple table, one name and a list of email-addresses:
>>>
>>> db.define_table('address',
>>>     Field('name'),
>>>     Field('emails','list:string', requires=IS_LIST_OF(IS_EMAIL()**)))
>>>
>>> Now I add one name and two email-addresses to this table.
>>>
>>> Id:      1
>>> Name:    Smith
>>> Emails:  jsm...@example.com
>>>          j...@example.com
>>>
>>> Everything looks fine.
>>>
>>> But if there is an error in the email-address (which is catched by the 
>>> validator), a lot goes wrong:
>>> Both email-addresses are converted to a list; this list is doubled and 
>>> ...
>>>
>>> Id:      1
>>> Name:    Smith
>>> Emails:  ['jsmith*#*example.com', 'j...@example.com']
>>>          ['jsmith#example.com', 'j...@example.com']
>>>
>>> ... there is no error message!
>>>
>>> Now I have changed the model to
>>>
>>> db.define_table('address',
>>>     Field('name'),
>>>     Field('emails','list:string', requires=IS_EMAIL()))
>>>
>>> but this model does not detect the wrong email address.
>>>
>>> What is the right way to use a validator with a list of strings?
>>>
>>> Regards, Martin
>>>
>>
>>  

-- 



Reply via email to