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
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
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)
-
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
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
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:
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 ==
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
Hi Ron,
Thanks for your reply, problem solved.
Kind regards,
Annet.
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
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
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
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] =
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
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
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
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.
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=#
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,
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
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
21 matches
Mail list logo