[web2py] Re: variables available in view

2016-02-20 Thread Pierre
sorry that was a trivial question: it's written in the book : http://web2py.com/books/default/search/29?search=response._vars globals() works too but not very 'orthodox' :) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source

[web2py] Re: variables available in view

2016-02-19 Thread Dave S
On Friday, February 19, 2016 at 10:13:31 AM UTC-8, Pierre wrote: > > hi everyone, > > I have a controller/function with different return cases: > like : > > if condition1: > return dict(var1=var1) > elif condition2: > return dict(var1=var1,var2=var2) > . > > how do I know in the

[web2py] Re: variables outside any function

2015-04-16 Thread Annet
Hi Anthony, Thanks for your reply and explanation. I put the paramters in the response object, problem solved. Kind regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: variables outside any function

2015-04-15 Thread Anthony
The views are executed in an environment that includes anything defined in models as well as whatever items are passed in the dictionary from the controller function. Other objects defined in the controller are not available in the view environment. So, you must pass items directly from the

[web2py] Re: Variables from url

2014-01-25 Thread Lucas Schreiber
Thanks :) It is exactly what i needed :) -- 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

[web2py] Re: Variables from url

2014-01-24 Thread Alan Etkin
Hi, I have a question: For example, somebody opens this page: .../profile/1 Now, in the def profile(): there shall be a variable: a=1 Or, when this page gets opened: .../profile/12345 I wish this variable: a=12345 This is discussed in detail in the web2py book:

[web2py] Re: variables to determine table columns from database

2012-08-07 Thread Anthony
rows = db(db[request.args(0)][request.args(2)] == request.args(1)).select ( Anthony On Tuesday, August 7, 2012 2:15:09 PM UTC-4, Larry Wapnitsky wrote: from a web page, i'm able to successfully query my database using the following: rows = db(db[request.args(0)].id ==

[web2py] Re: variables to determine table columns from database

2012-08-07 Thread Larry Wapnitsky
damned periods! :) Thanks, Anthony On Tuesday, August 7, 2012 2:49:53 PM UTC-4, Anthony wrote: rows = db(db[request.args(0)][request.args(2)] == request.args(1)).select ( Anthony On Tuesday, August 7, 2012 2:15:09 PM UTC-4, Larry Wapnitsky wrote: from a web page, i'm able to

[web2py] Re: Variables in javascript function.

2011-04-22 Thread annet
Hi Ron, Thanks for your reply, problem solved. Kind regards, Annet.

[web2py] Re: Variables in javascript function.

2011-04-22 Thread ron_m
Try changing name=window.open(url,name,'toolbar=yes,location=yes,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=width,height=height'); to have the variables width and height not inside the string literal quotes, something like this

[web2py] Re: Variables in queries

2011-02-22 Thread mart
Apologies if a repeat post (my mac is in the shop and working with this ... laptop... and nothing about it seems to work :( Anyways, my attempt at replying was something like, using dots after brackets should be fine, i do things like this and have no problems: '''--- select from tables

[web2py] Re: Variables in queries

2011-02-22 Thread mart
i think it should be ok to use dots after a var in brackets For example, I can do this, and all is fine: def select(self,tbl,var): db= self.db for mTbl in db.tables: if tbl in mTbl: if mTbl.startswith(tbl): for row in

[web2py] Re: Variables in queries

2011-02-22 Thread LightOfMooN
Thx! On 22 фев, 01:34, Bruno Rocha rochacbr...@gmail.com wrote: Yes, this is used in crud and appadmin db['tablename']['fieldname'] keys = ['table1','table2','table3'] mydict = {} for key in keys:    mydict[key] =

[web2py] Re: variables

2010-12-18 Thread Rick
Perhaps there is a way to get different variable values depending on what address you load??? For example: http:...default/index.html...something...n=1,m=0 On Dec 18, 4:07 am, Luther Goh Lu Feng elf...@yahoo.com wrote: You can use javascript or jquery(since web2py includes jquery) to do

[web2py] Re: variables

2010-12-18 Thread Rick
If n would be a global variable in a controller file, can I use something like this then? div id=the_id{{=n}}/div a href=# onclick=ajax('{{=URL('index')}}',[n=n+1],'the_id');return falseplus/a On Dec 18, 4:23 pm, Rick sababa.sab...@gmail.com wrote: Perhaps there is a way to get different

[web2py] Re: variables

2010-12-18 Thread weheh
I seriously doubt this would work. The [] where you have [n=n+1] is supposed to be a list of html targets whose values will be passed back to the controller URL('index'). The proper ajax call would be onclick=ajax('index',[],':eval');return false;. In this case, index is defined in the controller

[web2py] Re: variables

2010-12-17 Thread pbreit
I don't really understand the question. Do you want to change a JavaScript variable? Or a variable in your web2py code? I don't think you would be able to modify a web2py variable as the result of a click. By the time the suer views your page, all the web2py code has been rendered into HTML.

[web2py] Re: variables

2010-12-17 Thread Rick
Thanks for the replies! The variable that I'm operating with is python type, not javascript. Mdipierro, your solution looks nice, but i can't get it working. The value of the variable doesn't seem to change. Here is my code: from views/default/index.html: {{n=1}} a href=#

[web2py] Re: variables

2010-12-17 Thread Luther Goh Lu Feng
You can use javascript or jquery(since web2py includes jquery) to do this: ==javascript== $('#some_id).click(function() { $('#target).val( ($('#target).val()+1) ); } ) ==html== span id=some_ida href=# Click me/a/span span id=target2/span This should more or less work. On Dec 18,

[web2py] Re: variables turning into lists

2010-06-03 Thread Andrew Buchan
Iceberg, Thanks, you were right. I didn't think I had to know/care about whether requests were POST or GET with web2py (and indeed had to refresh my memory of what the difference was - I'm new to this whole interweb thing), as far as I was concerned I was just calling functions within

[web2py] Re: variables turning into lists

2010-06-02 Thread Iceberg
Did not look into your code. But this kind of situation usually is caused by a form receives variables from both GET and POST. In this case, request.vars.myvar=['blah', 'blah'], but request.get_vars.myvar='blah', and request.post_vars.myvar='blah'. So you can choose to use only one of it. On