[web2py] Re: using radio widget can't receive the empty submit

2012-02-01 Thread DenesL

You don't say what is that you were expecting.
Empty elements do not submit values.

Add the following to the end of your view so you can see what is being
sent/received each time:
{{=request.args}}{{=request.vars}}


On Feb 1, 5:29 am, Dan  wrote:
> Hello,
>
> I'm testing empty submit with the following two forms,  one is
> dropdown list and the other one is the checkradio box with v1.99.4.
>
> The dropdown list with empty select can successfully submit and got
> the expected responses.  But using checkradio widget, empty submit
> doesn't work and no response at all.
>
> Is this a bug for radio.widget or something else?  Many thanks.
>
> In my controller
> test.py
>
> form = SQLFORM.factory(Field('Form', requires=IS_IN_SET([],
> multiple='multiple')))
>     if form.accepts(request.vars,session,formname='form'):
>         response.flash = "Form Response"
>         message = form.vars
>
> xform = SQLFORM.factory(Field('FormX', requires=IS_IN_SET([],
> multiple='multiple'), widget = SQLFORM.widgets.radio.widget))
>     if xform.accepts(request.vars,session,formname='xform'):
>         response.flash = "Form X Response"
>         message = xform.vars
> return dict(xform=xform,form=form)
>
> In my viewer
> test.html
>
> {{=form}}
> {{=xform}}


[web2py] Re: using radio widget can't receive the empty submit

2012-02-01 Thread Dan
Hi Denesl,
Thanks for the hints. I got the sumbit info from the xform.

But what I want is the flash response "Form X Response" shows up like
the dropdown select form behaviors and other form.vars during the
submit.

In "form", it's okay but not in "xform".  Many thanks

On Feb 1, 11:56 pm, DenesL  wrote:
> You don't say what is that you were expecting.
> Empty elements do not submit values.
>
> Add the following to the end of your view so you can see what is being
> sent/received each time:
> {{=request.args}}{{=request.vars}}
>
> On Feb 1, 5:29 am, Dan  wrote:
>
> > Hello,
>
> > I'm testing empty submit with the following two forms,  one is
> > dropdown list and the other one is the checkradio box with v1.99.4.
>
> > The dropdown list with empty select can successfully submit and got
> > the expected responses.  But using checkradio widget, empty submit
> > doesn't work and no response at all.
>
> > Is this a bug for radio.widget or something else?  Many thanks.
>
> > In my controller
> > test.py
>
> > form = SQLFORM.factory(Field('Form', requires=IS_IN_SET([],
> > multiple='multiple')))
> >     if form.accepts(request.vars,session,formname='form'):
> >         response.flash = "Form Response"
> >         message = form.vars
>
> > xform = SQLFORM.factory(Field('FormX', requires=IS_IN_SET([],
> > multiple='multiple'), widget = SQLFORM.widgets.radio.widget))
> >     if xform.accepts(request.vars,session,formname='xform'):
> >         response.flash = "Form X Response"
> >         message = xform.vars
> > return dict(xform=xform,form=form)
>
> > In my viewer
> > test.html
>
> > {{=form}}
> > {{=xform}}
>
>


[web2py] Re: using radio widget can't receive the empty submit

2012-02-02 Thread DenesL
Your view does not include the default layout which in turn includes
the response.flash, so you have to put it in your view somewhere:

{{=response.flash}}


On Feb 1, 9:11 pm, Dan  wrote:
> Hi Denesl,
> Thanks for the hints. I got the sumbit info from the xform.
>      '_formname': 'xform'}>
> But what I want is the flash response "Form X Response" shows up like
> the dropdown select form behaviors and other form.vars during the
> submit.
>
> In "form", it's okay but not in "xform".  Many thanks


[web2py] Re: using radio widget can't receive the empty submit

2012-02-05 Thread Dan
My view did include the default layout, I omit it when I writing this
discussions.

The response.flash can show up when I submit my first form.
But it doesn't work when I submit the second form which used the
widget = SQLFORM.widgets.radio.widget.

On Feb 3, 1:27 am, DenesL  wrote:
> Your view does not include the default layout which in turn includes
> the response.flash, so you have to put it in your view somewhere:
>
> {{=response.flash}}
>
> On Feb 1, 9:11 pm,Dan wrote:
>
> > Hi Denesl,
> > Thanks for the hints. I got the sumbit info from the xform.
> >      > '_formname': 'xform'}>
> > But what I want is the flash response "Form X Response" shows up like
> > the dropdown select form behaviors and other form.vars during the
> > submit.
>
> > In "form", it's okay but not in "xform".  Many thanks
>
>


[web2py] Re: using radio widget can't receive the empty submit

2012-02-06 Thread DenesL
It works for me.
Try with this view (which does not include the layout):

{{=form}}
{{=xform}}
{{=request.args}}{{=request.vars}}
response.flash={{=response.flash}}


On Feb 6, 2:49 am, Dan  wrote:
> My view did include the default layout, I omit it when I writing this
> discussions.
>
> The response.flash can show up when I submit my first form.
> But it doesn't work when I submit the second form which used the
> widget = SQLFORM.widgets.radio.widget.
>


[web2py] Re: using radio widget can't receive the empty submit

2012-02-06 Thread Dan
It seems no luck for me.

I got following output when I submit my first form
[]
 response.flash=Form

but when comes into the second form, the response.flash is empty.
[]
 response.flash=

On Feb 6, 9:37 pm, DenesL  wrote:
> It works for me.
> Try with this view (which does not include the layout):
>
> {{=form}}
> {{=xform}}
> {{=request.args}}{{=request.vars}}
> response.flash={{=response.flash}}
>
> On Feb 6, 2:49 am,Dan wrote:
>
> > My view did include the default layout, I omit it when I writing this
> > discussions.
>
> > The response.flash can show up when I submit my first form.
> > But it doesn't work when I submit the second form which used the
> > widget = SQLFORM.widgets.radio.widget.
>
>


[web2py] Re: using radio widget can't receive the empty submit

2012-02-07 Thread DenesL
It will work if you have values inside the IS_IN_SET validators in
your controller, e.g.

IS_IN_SET([1,2,3,4],multiple='multiple')


[web2py] Re: using radio widget can't receive the empty submit

2012-02-07 Thread Dan
You are right, if I used an non-empty list to submit, both forms work
fine.
so the widget = SQLFORM.widgets.radio.widget did have different
behavior to the form submission.


On Feb 7, 11:08 pm, DenesL  wrote:
> It will work if you have values inside the IS_IN_SET validators in
> your controller, e.g.
>
> IS_IN_SET([1,2,3,4],multiple='multiple')


[web2py] Re: using radio widget can't receive the empty submit

2012-02-08 Thread DenesL

Note that when there are no values in the set then *no* input
type=radio fields are created in the form, so there is nothing to send
when you submit the form.

On Feb 7, 10:38 pm, Dan  wrote:
> You are right, if I used an non-empty list to submit, both forms work
> fine.
> so the widget = SQLFORM.widgets.radio.widget did have different
> behavior to the form submission.


[web2py] Re: using radio widget can't receive the empty submit

2012-02-08 Thread Dan
Got it. Thanks a lot for your patience and the explanation.

On Feb 8, 10:45 pm, DenesL  wrote:
> Note that when there are no values in the set then *no* input
> type=radio fields are created in the form, so there is nothing to send
> when you submit the form.
>
> On Feb 7, 10:38 pm,Dan wrote:
>
> > You are right, if I used an non-empty list to submit, both forms work
> > fine.
> > so the widget = SQLFORM.widgets.radio.widget did have different
> > behavior to the form submission.
>
>