It works now.

> This was wrong to begin with. It is not clear if this should be

I don't understand. The example is a valid form. The only problem was
that it had an error div for each checkbox. Why is it wrong?



On Nov 22, 5:55 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> lol. Please check again the code in trunk. Anyway, reading again the
> original post...
>
> > form = SQLFORM.factory(Field('multiple_options', requires=IS_IN_SET(('Hi',
> > 'Milk', 'Mom', 'Love', 'Santa')), widget=SQLFORM.widgets.checkboxes.widget))
>
> This was wrong to begin with. It is not clear if this should be
>
>   form = SQLFORM.factory(Field('multiple_options', requires=IS_IN_SET
> (('Hi',
>   'Milk', 'Mom', 'Love', 'Santa'),multiple=True),
> widget=SQLFORM.widgets.checkboxes.widget))
>
> or
>
>   form = SQLFORM.factory(Field('multiple_options', requires=IS_IN_SET
> (('Hi',
>   'Milk', 'Mom', 'Love', 'Santa'),default='Hi'),
> widget=SQLFORM.widgets.radio.widget))
>
> none of which should require the patch in trunk.
> Only case checkboxes may need to report an error is if one is
> tampering with the form or if one is setting weird constraints like
> "select any two of the following".
>
> Massimo
>
> On Nov 22, 5:24 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > You fixed it too much :) It doesn't give an error at all now.
>
> > On Nov 22, 3:48 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Can you please check the fix in trunk?
>
> > > Massimo
>
> > > On Nov 21, 6:51 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > well' This is a bug. I think the proper fix would be to edit html.py
> > > > and make sure that only checked boxes display the error.
>
> > > > On Nov 21, 6:15 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > Here's a lame workaround. It's a widget that removes all of the error
> > > > > divs except the last one:
>
> > > > > def checkboxes_widget(f,v):
> > > > >     wrapper = DIV(_id="%s_wrapper" % f.name)
> > > > >     inp = SQLFORM.widgets.checkboxes.widget(f,v)
> > > > >     scr = SCRIPT('jQuery("div[id=\'%s__error\']").slice(0,-1).remove
> > > > > ();' %
> > > > >                   f.name,_type="text/javascript")
> > > > >     wrapper.components.extend([inp,scr])
> > > > >     return wrapper
>
> > > > > On Nov 21, 3:45 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
>
> > > > > > form = SQLFORM.factory(Field('multiple_options', 
> > > > > > requires=IS_IN_SET(('Hi',
> > > > > > 'Milk', 'Mom', 'Love', 'Santa')), 
> > > > > > widget=SQLFORM.widgets.checkboxes.widget))
>
> > > > > > Submit the form without selecting anything, and it displays the 
> > > > > > error
> > > > > > message on each INPUT() helper.
>
> > > > > > You can also change widget to SQLFORM.widgets.radio.widget and it 
> > > > > > will have
> > > > > > the same effect.
>
> > > > > > -Thadeus
>
> > > > > > On Sat, Nov 21, 2009 at 3:35 PM, mr.freeze <nat...@freezable.com> 
> > > > > > wrote:
>
> > > > > > > Can you post some example code that produces the effect? Just 
> > > > > > > want to
> > > > > > > make sure I'm understanding the problem correctly.
>
> > > > > > > On Nov 21, 1:55 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> > > > > > > >http://static.thadeusb.com/web2py_checkboxes_fail.png
>
> > > > > > > > Pleeeeeeaze fix!!!
>
> > > > > > > > I have a patch, but it is not backwards-compatible.
>
> > > > > > > > Is this an area where it is a bug, or a feature to have 
> > > > > > > > multiple error
> > > > > > > > messages for checkboxes/radio widgets?
>
> > > > > > > > -Thadeus
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to