If you have multiple {{=INTPUT(_name='....')}} with the same name you
want to set {{=INPUT(_name='....',hideerror=True)}} for some of them.

On Sep 1, 12:06 pm, Eric <hu5...@gmail.com> wrote:
> Pardon me for resurrecting a dead thread, but can any of the
> participants elaborate on the solution to this issue?  I'm trying to
> accomplish the same goal of eliminating identical repeated error
> messages under each radio button in an SQLform using the radio
> widget.  I still want an error message if the radio group is empty on
> submission, just not identical error messages under each radio
> element.
>
> I'm using some of the solutions described below and it's not working
> so I'm assuming that I'm implementing them wrong.  Can anyone explain
> exacting how they used this solution?
>
> Thank you in advance for your explanation.
>
> Eric
>
> On Apr 6, 7:07 pm, bluemoth <duane.malc...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thanks DenesL and Massimo,
>
> > I think e['hideerror]=True is the solution.
>
> > I wasn't sure before but this confirms that the requirements are
> > checked on the server-side after the post. I thought it might be done
> > before the post using javascript or ajax.
>
> > Cheers, Duane.
>
> > On Apr 7, 7:41 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > > OK, here is one way:
>
> > > def radio_msg():
> > >   opts=['english', 'french', 'german']
> > >   form=SQLFORM.factory(
> > >     Field('language', 'string',
> > >       requires = IS_IN_SET(opts),
> > >       widget = SQLFORM.widgets.radio.widget
> > >     )
> > >   )
> > >   if form.accepts(request):
> > >     response.flash='ok'
> > >   elif form.errors:
> > >     # turn offerrormsg for all but lastradiofield
> > >     for opt in opts[:-1]:
> > >       form.element('input[type=radio][value=%s]'%opt)
> > > ['hideerror']=True
> > >     response.flash='not ok'
> > >   return dict(form=form)
>
> > > On Apr 6, 11:14 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > Theradioelements do not have an id, and even if they did this would
> > > > turn allmessagesoff, the idea is to leave only one.
>
> > > > It would be easy with jQuery, something like:
>
> > > > $("div#language__error").each(function() {$(this).hide();});
> > > > $("div#language__error").last().show();
>
> > > > where "language" is theradiofield name in this case.
>
> > > > On Apr 6, 9:18 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
> > > > wrote:
>
> > > > > you can do
>
> > > > > for e in form.elements('input#id'): e['hideerror']=True
>
> > > > > and matching fields would not display errors.
>
> > > > > On Apr 6, 4:30 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > > > In principle I agree that it looks bad to have the sameerrorpop up
> > > > > > for eachradiofield, 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 inerrorif no particular one was chosen.
>
> > > > > > On Apr 5, 9:08 pm, bluemoth <duane.malc...@gmail.com> 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 
> > > > > > > theradio
> > > > > > > buttons relate to the same field and treat them as a group. But we
> > > > > > > still need an appropriate place/target to report theerror. This 
> > > > > > > could
> > > > > > > be after the last input (radiobutton) 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 <duane.malc...@gmail.com> 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 
> > > > > > > > theerror
> > > > > > > >messagesfor theradiobuttons into one message.
>
> > > > > > > > Cheers, Duane.
>
> > > > > > > > On Apr 6, 10:56 am, DenesL <denes1...@yahoo.ca> wrote:
>
> > > > > > > > > Hello,
>
> > > > > > > > > to eliminate the possibility of anerrormessage, 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 <duane.malc...@gmail.com> 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
> > > > > > > > > >errormessage under eachradiobutton.
>
> > > > > > > > > > Is there a way to present the oneerrormessage for the 
> > > > > > > > > > entire group
> > > > > > > > > > ofradiobuttons?
>
> > > > > > > > > > Thanks for you help.
>
> > > > > > > > > > Cheers, Duane.

Reply via email to