I see the problem. You miss a INPUT(_type="submit") button in the form and
you expect the value to change on the server without submitting the form.
This requires Ajax. For example:
def index():
test = SELECT(['Ram', 'Satish', 'Kumar',
],_name='test',_onchange="jQuery.post('%s',{'test':jQuery(this).val()})" %
URL('callback'))
return dict( test=test)
def callback():
session.test = request.post_vars.test
On Thursday, 22 August 2013 11:55:56 UTC-5, sonu kumar wrote:
>
> Thanks Massimo.
> But still session.test is not storing value when I change value in view.
>
> I also tried to print it out session.test in other function it says None.
>
> thanks
> Sonu
>
> On Thursday, 22 August 2013 00:25:02 UTC-7, Massimo Di Pierro wrote:
>>
>> def index():
>> test = FORM('Select name:',SELECT(['Ram', 'Satish', 'Kumar',
>> ],_name='test'))
>> if test.process().acceped:
>> session.test = test.vars.test
>> return dict( test=test)
>>
>> On Wednesday, 21 August 2013 14:17:55 UTC-5, sonu kumar wrote:
>>>
>>> Hi,
>>>
>>> I have created select button through controller and I would like to
>>> store value of select after onchange in a variable so that I can use in
>>> other functions. Is there anyway to do it?
>>>
>>> def index():
>>> test = FORM('Select name:',SELECT(['Ram', 'Satish', 'Kumar',
>>> ],_name='test'),_onchange='')
>>> session.test = test.vars.test
>>>
>>> return dict( test=test)
>>>
>>> Thanks
>>>
>>>>
>>>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.