In principle I agree that it looks bad to have the same error pop up
for each radio field, but the reality is that each option is handled
as a separate entity even in the HTML code, so I doubt this is an easy
one to "fix".

It is also a matter of interpretation, to go back to your example, all
of them would be in error if no particular one was chosen.


On Apr 5, 9:08 pm, bluemoth <[email protected]> wrote:
> Hi,
>
> I originally thought the FIELDSET might hold the solution but no.
> Maybe it can be used.
>
> Otherwise, I think the solution might be to recognise that the radio
> buttons relate to the same field and treat them as a group. But we
> still need an appropriate place/target to report the error. This could
> be after the last input (radio button) or a defined target in the
> validator e.g., require=IS_NOT_EMPTY(error_target='target')
>
> It's not an urgent issue. I did some searching and couldn't find the
> solution. I will want to overcome this later but don't want to
> implement my own solution if one exists or can be added.
>
> Cheers, Duane.
>
> On Apr 6, 12:55 pm, bluemoth <[email protected]> wrote:
>
>
>
>
>
>
>
> > Thanks DenesL,
>
> > It was probably the wrong example. I simplified my case but in my case
> > I do expect errors to be reported so I was wanting to group the error
> > messages for the radio buttons into one message.
>
> > Cheers, Duane.
>
> > On Apr 6, 10:56 am, DenesL <[email protected]> wrote:
>
> > > Hello,
>
> > > to eliminate the possibility of an error message, I would rewrite as:
>
> > > db.languages.language.default = 'english' # or any other in the list
> > > db.languages.language.requires = IS_IN_SET(['english', 'french',
> > > 'german'])
> > > db.languages.language.widget = SQLFORM.widgets.radio.widget
>
> > > On Apr 5, 6:32 pm, bluemoth <[email protected]> wrote:
>
> > > > Hello all,
>
> > > > If I have the following:
> > > > db.define_table('languages', Field('language', 'string'))
>
> > > > db.languages.language.requires = \
> > > >                 [IS_IN_SET(['english', 'french', 'german']), \
> > > >                  IS_NOT_EMPTY(error_message='Value required')]
> > > > db.languages.language.widget = SQLFORM.widgets.radio.widget
>
> > > > and I render a form that when submitted has no entry, it places an
> > > > error message under each radio button.
>
> > > > Is there a way to present the one error message for the entire group
> > > > of radio buttons?
>
> > > > Thanks for you help.
>
> > > > Cheers, Duane.

Reply via email to