For the record.... field.requires.options()
You have to call that :) Why is this? -Thadeus On Sat, Nov 28, 2009 at 6:53 PM, Thadeus Burgess <[email protected]>wrote: > The custom categories checkboxes widget I am using for plugincentral is > broken. > > Did you change anything that might effect this? > > -Thadeus > > > > > > On Sun, Nov 22, 2009 at 8:13 PM, mr.freeze <[email protected]> wrote: > >> >> Yes, but having no default means that the user will be required to >> actively choose. I like that. Anyway, i'm splitting hairs. Thanks >> for the patch. >> >> On Nov 22, 7:59 pm, mdipierro <[email protected]> wrote: >> > Because IS_IN_SET(,multiple=False) implies an exclusive choice. In >> > this case you must use radio buttons, not checkboxes. >> > >> > On Nov 22, 6:13 pm, "mr.freeze" <[email protected]> wrote: >> > >> > > 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 <[email protected]> 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" <[email protected]> wrote: >> > >> > > > > You fixed it too much :) It doesn't give an error at all now. >> > >> > > > > On Nov 22, 3:48 pm, mdipierro <[email protected]> wrote: >> > >> > > > > > Can you please check the fix in trunk? >> > >> > > > > > Massimo >> > >> > > > > > On Nov 21, 6:51 pm, mdipierro <[email protected]> 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" <[email protected]> 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 <[email protected]> >> 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 < >> [email protected]> 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 < >> [email protected]> 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 [email protected] >> To unsubscribe from this group, send email to >> [email protected]<web2py%[email protected]> >> For more options, visit this group at >> http://groups.google.com/group/web2py?hl=en >> -~----------~----~----~----~------~----~------~--~--- >> >> > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

