In the view with javascript you can do that :
To set content of session.var you will need a python function for that,
something like that :
def __create_update_session_var():
id = request.vars.id
value = request.vars.value
session.var = id
#or
#session.var = value
#or
#session.var = db.table(id).value
$(function() {
var id = $('#myselect option:selected').val();
// or
//var value = $('#myselect option:selected').text(); // But you don't
really need to you can get the value from the id
$.ajax({
url: {{=URL('controller', 'create_update_session_var', vars=dict(id=id,
value=value))}}
});
});
Not tested, but you can work around this example the basic idea is there.
Note that javascript is asynchrone and for that reason the session.var may
not be there when you need it. But if you just need to put something in
session for the next page to load there should be no problem.
If you disclose more detail about what you really want to do, we can
propose other/better design...
Richard
On Thu, Nov 7, 2013 at 4:25 PM, greenpoise <[email protected]> wrote:
> Hi Richard
>
> Thanks for the help. I keep looking. If I select the item from the
> autocomplete, I just want to grab the id and all the info pertaining to
> that record and put it in a session. I dont know how to do it. Do you have
> a better picture of my question?
>
> THanks again
>
>
>
> On Wednesday, November 6, 2013 7:21:44 AM UTC-8, Richard wrote:
>
>> Wait, you just want to redirect on a list base on a drop box selected
>> item?
>>
>> What do yo do with the list? Select again, or just consult?
>>
>> For the latter you can easely do it with 2 LOAD component into a
>> container page. One component is your form with your dropbox and the other
>> component containt you selected item list, it is empty at first and when
>> you form id submit it get updated. You can do that with web2py_component()
>> and LOAD().
>>
>> I can help you, by showing some piece of code that you could adapt.
>>
>> You can also avoid submitting the form by adding a piece of js that will
>> submit the form onclick of a item in the dropbox...
>>
>> Richard
>>
>>
>> On Wed, Nov 6, 2013 at 10:14 AM, Richard Vézina <[email protected]>wrote:
>>
>>> But I may be fooled by the title... I am not sure now if it a
>>> replacement for lazy option plugin - http://dev.s-cubism.com/
>>> plugin_lazy_options_widget - or not... I thought it was, but I didn't
>>> test it yet.
>>>
>>> But I use lazy_option_widget, and I broke it dependency to the other
>>> plugin... If you want the piece of js for that, just tell me.
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>> On Wed, Nov 6, 2013 at 10:11 AM, Richard Vézina
>>> <[email protected]>wrote:
>>>
>>>> No, this : https://groups.google.com/d/msg/web2py/HhK8o0RBDNc/Ralcjl_
>>>> q5MQJ
>>>>
>>>> Conditional field...
>>>>
>>>> 2.5.1
>>>>
>>>> - New style virtual fields in grid
>>>> - Conditional fields (experimental) db.table.field.show_if =
>>>> db.table.otherfield==True or db.table.field.show_if =
>>>> db.table.otherfiel.contains(values)
>>>> - auth.settings.manager_group_role="manager" enables http://.../app/
>>>> appadmin/auth_manage and http://.../app/appadmin/manage for members
>>>> of the "manager" group. (also experimental)
>>>> - support for POST variables in DELETE
>>>> - Fixed memory leak when using the TAG helper
>>>>
>>>>
>>>> Richard
>>>>
>>>>
>>>> On Tue, Nov 5, 2013 at 2:42 PM, greenpoise <[email protected]> wrote:
>>>>
>>>>> you mean this one?
>>>>>
>>>>> http://www.web2pyslices.com/slice/show/1724/cascading-
>>>>> dropdowns-simplified
>>>>>
>>>>>
>>>>>
>>>>> On Tuesday, November 5, 2013 10:57:08 AM UTC-8, Richard wrote:
>>>>>
>>>>>> You want a kind of conditional drop down from what I understand...
>>>>>> There recent new feature exactly for this...
>>>>>>
>>>>>> I don't know if it has been documented, but there is example of the
>>>>>> synthax on the group.
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>> On Tue, Nov 5, 2013 at 12:49 PM, greenpoise <[email protected]>wrote:
>>>>>>
>>>>>>> is very simple. The autocomplete works fine. The only thing that I
>>>>>>> want is once the product is searched and selected, to go into some sort
>>>>>>> of
>>>>>>> list of items. So technically my subject is wrong, it should be OnClick
>>>>>>> instead of OnSelect:
>>>>>>>
>>>>>>> db.define_table('productsearch',
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Field <http://127.0.0.1:8000/examples/global/vars/Field>('tilename'))
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> db.productsearch.tilename.widget=SQLFORM
>>>>>>> <http://127.0.0.1:8000/examples/global/vars/SQLFORM>.widgets.autocomplete(request
>>>>>>>
>>>>>>> <http://127.0.0.1:8000/examples/global/vars/request>,db.product.tilename,
>>>>>>> id_field=db.product.id)
>>>>>>>
>>>>>>>
>>>>>>> def psearch():
>>>>>>> form=SQLFORM <http://127.0.0.1:8000/examples/global/vars/SQLFORM>(
>>>>>>> db.productsearch)
>>>>>>> return dict(form=form)
>>>>>>>
>>>>>>>
>>>>>>> On Monday, November 4, 2013 6:07:42 PM UTC-8, Richard wrote:
>>>>>>>
>>>>>>>> Can show you some code, but it is heavily customized so it may be
>>>>>>>> not what you want...
>>>>>>>>
>>>>>>>> Just let me know.
>>>>>>>>
>>>>>>>> Richard
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, Nov 4, 2013 at 4:41 PM, greenpoise <[email protected]>wrote:
>>>>>>>>
>>>>>>>>> Thanks, will check!
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Monday, November 4, 2013 12:10:59 PM UTC-8, Richard wrote:
>>>>>>>>>
>>>>>>>>>> Notice this : http://stackoverflow.com/que
>>>>>>>>>> stions/17903645/where-is-the-typeahead-javascript-module-in-
>>>>>>>>>> bootstrap-3-rc-1
>>>>>>>>>>
>>>>>>>>>> Richard
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Mon, Nov 4, 2013 at 2:58 PM, Richard Vézina <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Do you know bootstrap typeahead?
>>>>>>>>>>>
>>>>>>>>>>> You can customized it as you want then you only have to pass a
>>>>>>>>>>> function that return a json...
>>>>>>>>>>>
>>>>>>>>>>> Richard
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Nov 4, 2013 at 1:41 PM, greenpoise
>>>>>>>>>>> <[email protected]>wrote:
>>>>>>>>>>>
>>>>>>>>>>>> I have an Autocomplete widget field that goes through my
>>>>>>>>>>>> product table. I need to put the selected product into a list.
>>>>>>>>>>>> Rather than
>>>>>>>>>>>> using the button after I select the product, ideally I would like
>>>>>>>>>>>> to select
>>>>>>>>>>>> the product and it automatically goes into the list and the search
>>>>>>>>>>>> field
>>>>>>>>>>>> stays on top. Could someone lead me to this? what is it called?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Resources:
>>>>>>>>>>>> - http://web2py.com
>>>>>>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>>>>>>> ---
>>>>>>>>>>>> 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/grou
>>>>>>>>>>>> ps/opt_out.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>> Resources:
>>>>>>>>> - http://web2py.com
>>>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>>>> ---
>>>>>>>>> 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.
>>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>> Resources:
>>>>>>> - http://web2py.com
>>>>>>> - http://web2py.com/book (Documentation)
>>>>>>> - http://github.com/web2py/web2py (Source code)
>>>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>>>> ---
>>>>>>> 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.
>>>>>>>
>>>>>>
>>>>>> --
>>>>> Resources:
>>>>> - http://web2py.com
>>>>> - http://web2py.com/book (Documentation)
>>>>> - http://github.com/web2py/web2py (Source code)
>>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>>> ---
>>>>> 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.
>>>>>
>>>>
>>>>
>>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> 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.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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.