Well, the simplest solution is to change the form method to GET: <form action = "{{=URL('operations')}}" method = "GET" >
That will put the "table" variable in the URL query string, where it will persist. However, with this method, the search feature won't work because it uses the query string and doesn't preserve the existing query string. If you want to use the session instead, you could do something like this (leaving the form method set to "POST" in this case): def operations(): if request.post_vars and 'table' in request.post_vars: session.operations_table = request.post_vars.table if not session.operations_table: redirect(URL('default', 'action_to_select_operations_table')) grid = SQLFORM.grid(db[session.operations_table], user_signature=False) return locals() When the form first posts to the operations action, the table name will be stored in the session. If someone tries to access the URL without the table name being stored in the session, it will redirect to the form where the table can be selected. Anthony On Saturday, August 8, 2015 at 11:24:53 AM UTC-4, ESRA GÜÇLÜ wrote: > > i have a different page which has named show and here its code: > > <form action = "{{=URL('operations')}}" method = "POST" > > <legend> > İşlem yapacağınız tabloyu seçiniz. > <select name = "table"> > <option value="computer">Bilgisayar</option> > <option value="pc_case">Kasa</option> > <option value="printer">Yazıcı</option> > <option value="scanner">Tarayıcı</option> > <option value="keyboard">Klavye</option> > <option value="mouse">Fare</option> > <option value="cable">Kablo</option> > <option value="cartridge">Kartuş</option> > </select> > <input type = "submit" value = "Tamam" > > </legend> > </form> > > i get the choice with request.vars.table from the other page. > I tried to store the choice with session but I could not, as i sad, I'm > pretty new to web2py. > Sir, can you show that how can store the choice with session? > And I'm thankful for your quick reply, thanks a lot. > > 2015-08-08 15:25 GMT+03:00 Anthony: > >> Two additional (probably preferable) options: >> >> 1. Store the table selection in the session so you don't have to keep >> it in the URL. >> 2. Set the table name as a URL arg, and use the grid's "args" >> argument to tell the grid to ignore that arg (and leave it in place). The >> benefit of this approach is that you don't end up with an ugly query >> string >> in the URL, but the URL does show the table name, making it bookmarkable >> and more clear what resource is being retrieved. >> >> Anthony >> >> On Saturday, August 8, 2015 at 8:18:50 AM UTC-4, Anthony wrote: >>> >>> On Saturday, August 8, 2015 at 4:25:40 AM UTC-4, ESRA GÜÇLÜ wrote: >>>> >>>> requires.var.table gets the choice from user and it works sir. >>>> i can access the grid and i did but grid's buttons do not work because >>>> of having error. >>>> >>> >>> Yes, but how is request.vars.table being set (i.e., what does "choice >>> from user" mean)? Do you have a different page with a form where the user >>> makes a choice? If so, does the form's action point to the page with the >>> grid, or is it self-submitting followed by a redirect? Does the form make a >>> POST or a GET request? Please show all the relevant code. >>> >>> In short, for this to work, you need to put the table name in the URL >>> query string, otherwise it will not persist from request to request when on >>> the grid page. >>> >>> Anthony >>> >> -- >> 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 web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.