[web2py] Re: ajax function

2011-04-05 Thread Ross Peoples
Could you be a little more specific? Are you trying to pass args and vars? Or are you trying to load HTML using AJAX and sending it to a target DIV? If you are using web2py's ajax function, you may be limited to what you can do. Worst case, you can always try calling jQuery's load() method: var

[web2py] Re: ajax function

2011-04-06 Thread leone
I need to use ajax web2py function passing a costant, es.: ajax(url,[ 'namefld1', 'namefld2', 'costant-value'], ':eval') Exploring code I see that I must insert an input tag with desidered value and call it by name. There is a smarter way? Thanks On 5 Apr, 16:06, Ross Peoples wrote: >

[web2py] Re: ajax function

2011-04-06 Thread Massimo Di Pierro
Make an 'hidden' input field. On Apr 6, 7:59 am, leone wrote: > I need to use ajax web2py function passing a costant, es.: > >       ajax(url,[ 'namefld1', 'namefld2', 'costant-value'], ':eval') > > Exploring code I see that I must insert an input tag with desidered > value and call it by name. >

[web2py] Re: ajax function

2011-04-06 Thread DenesL
You can add the constant as an arg but to the url. Also note that components, i.e. LOAD(), allow args and vars. On Apr 6, 8:59 am, leone wrote: > I need to use ajax web2py function passing a costant, es.: > >       ajax(url,[ 'namefld1', 'namefld2', 'costant-value'], ':eval') > > Exploring code

[web2py] Re: Ajax function

2013-11-13 Thread Derek
You're using eval, but are you returning executable javascript from your function 'paginatore' ? On Tuesday, November 12, 2013 7:17:52 AM UTC-7, Luca Dalla Palma wrote: > > > Hello, > this is my *view* > > > on the *controller *I build a function containing the folowing code: > > pippone='ciao'

[web2py] Re: ajax function returns None

2011-08-16 Thread Massimo Di Pierro
Try I think this is typo in the book. On Aug 16, 6:53 am, Martin Weissenboeck wrote: > Hi, > > I have tried the example from chapter 10.3 The ajax Function > > Controller: > def one(): >     return dict() > > def echo(): >     return request.vars.name > > one.html: > {{extend 'layout.html'}} >

[web2py] Re: ajax function : None returned

2011-10-06 Thread juanduke
Hi Vineet: You need to change this line; for this line: (change id='name' for name="name") HTH!!! Bye

[web2py] Re: ajax function : None returned

2011-10-06 Thread Vineet
Hi juanduke ! Thanks for the tip. It worked. I will do some more complicated work on this now. Cheers, Vineet On Oct 6, 5:03 pm, juanduke wrote: > Hi Vineet: > > You need to change this line; > >     > > for this line: > >     > > (change id='name' for name="name") > HTH!!! > Bye

Re: [web2py] Re: ajax function returns None

2011-08-16 Thread Martin Weissenboeck
Now I have tried: {{extend 'layout.html'}} Sorry, same result: "None" echo is called, but request.vars does not contain any value. Martin 2011/8/16 Massimo Di Pierro Try > > > > I think this is typo in the book. > > On Aug 16, 6:53 am, Martin Weissenboeck wrote: > > Hi, > > > > I have

Re: [web2py] Re: ajax function returns None

2011-08-16 Thread Martin Weissenboeck
Sorry, my mistake... It works! There has been a file "one.html" and another file "one.html.bak" The editor opens "one.html.bak" (why?), but web2py uses "one.html" (of course!) Thnak you very much! 2011/8/16 Martin Weissenboeck > Now I have tried: > > {{extend 'layout.html'}} > > > > > > >

[web2py] Re: ajax function submit on script

2011-04-28 Thread Massimo Di Pierro
yes but the syntax is incorrect: ajax('blog_show', 'comments hidden') should be ajax('blog_show', [], 'target_id') On Apr 28, 8:58 am, 黄祥 wrote: > hi, > > is it possible to put ajax function submit on script? > e.g. > > jQuery(document).ready(function(){ >     jQuery('.view').click(func

[web2py] Re: ajax function target id null

2010-06-24 Thread mdipierro
You cannot but if you do ajax('func1', ['id1'], ':eval') it will interpret the returned page as json and evaluate it. id If you return 'null' or '', it should work as expected and not raise any error. On Jun 24, 9:47 am, ilovesss2004 wrote: > Hi, > I use the ajax function as follows: > > ajax('

Re: [web2py] Re: ajax function submit on script

2011-04-28 Thread Stifan Kristi
thank you so much for your correction, massimo. it runs right now with: jQuery(document).ready(function(){ jQuery('.view').click(function(){jQuery('.comments').slideToggle()}); jQuery('.post').click(function(){jQuery('.form').slideToggle()}); jQuery('.post').submit(function(){ajax('{{=r

[web2py] Re: Ajax function and returning Row, not string

2013-06-18 Thread Derek
One more thing - I've seen people have issues with this time and again on this list. You aren't the first person to think of doing this. Look for a good recipe on web2pyslices which does what you want. There are quite a few. http://www.web2pyslices.com/slice/show/1467/cascading-drop-down-lists-w

[web2py] Re: Ajax function and returning Row, not string

2013-06-18 Thread Derek
Well, you're doing it wrong. I mean, the way you are calling the ajax function... ajax('rank', ['department'], 'seafarer_experience_rank'); What that does is calls 'rank' with the argument 'department' and replace the contents of the element whose ID is 'seafarer_experience_rank' with the res

[web2py] Re: Ajax function and returning Row, not string

2013-06-19 Thread lesssugar
Yes, my assumption was incorrect. I thought ajax() would return a Row object to my ID target element, so then I could use it within the element. "I have never been so wrong". Well, it works now: controller: def rank(): ranks = db(db.rank.department_id == request.vars.department).select(d

[web2py] Re: ajax() function doesn't work properly (returns parent page)

2012-05-02 Thread Anthony
Try going to http://127.0.0.1:8000/inventoryapp/default/index/ (note the trailing "/"), and you should see the same problem. On the storeadmin page, the problem should go away if you exclude the trailing "/" from the URL. The problem is, in the call to ajax(), the URL is just 'echo'. Because it

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Anthony
On Tuesday, November 8, 2011 7:45:59 AM UTC-5, Vineet wrote: > > In a View, there is --> ajax('{{=URL("salhead_edit")}}, [], > ':eval'); > Probably a typo, but missing the closing single quote (') after the }} for the URL. > "salhead_edit" returns js function --> 'abc(myvar1)' > Unless 'm

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Vineet
> Probably a typo, but missing the closing single quote (') after the }} for > the URL. It is a typo here. It is correct in actual code. > If 'myvar' is a Python variable, you're going 'myvar' is a not a python variable. I pass the id of html element as argument. Javascript code sets the value o

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Anthony
On Tuesday, November 8, 2011 8:17:41 AM UTC-5, Vineet wrote: > > > If 'myvar' is a Python variable, you're going > > 'myvar' is a not a python variable. > I pass the id of html element as argument. > Javascript code sets the value of that html element. OK, but same problem -- 'myvar1' isn't a

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Vineet
Something is wrong in the function. I defined a test js function in View. function alrt(mesg) { alert(mesg) }; And in Controller, return "alrt('Hello World!');" It works. The actual js function is--- (it sees which value of select box matches the one returned from controller; then sets the valu

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Vineet
I checked the js returned from controller function. It is selbx('edit_freq','daily'); selbx function is there in the View. -- Vineet On Nov 8, 7:04 pm, Vineet wrote: > Something is wrong in the function. > I defined a test js function in View. > > function alrt(mesg) { > alert(mesg) }; > >

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Anthony
I think you need .options[i] rather than .options(i). Anyway, it's generally easier to do this kind of thing with jQuery rather than raw Javascript. Anthony On Tuesday, November 8, 2011 9:04:41 AM UTC-5, Vineet wrote: > > Something is wrong in the function. > I defined a test js function in Vi

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Vineet
h.. Seems that I need to return js code from controller. btw, I have found a one-line jquery code for this--> "$('#element_id option[value=%s]').attr('selected', 'selected');" % dict_obj['key'] This works & I will proceed with this, for time being. Thanks for your responses Anthony. --- Vine

[web2py] Re: ajax function with eval : return js function from controller

2011-11-08 Thread Vineet
h.. Seems that I need to return js code lines (not js function) from controller & get going ahead. btw, I have found one line jquery code for selecting value of select box. "$('#element_id option[value=%s]').attr('selected', 'selected');" % adict['key'] Thanks for your responses Anthony. ---

[web2py] Re: ajax function in a grid, I'm getting None in a request.vars

2013-03-29 Thread Tim Richardson
On Saturday, 30 March 2013 16:23:26 UTC+11, Tim Richardson wrote: > > I'm trying to learn more about LOAD and ajax. > > I have an SQLFORM.grid loaded as a component. It's read only. > So this means the result is just an HTML table, not a form, so the field name is actually not there. looking a

[web2py] Re: ajax function in a grid, I'm getting None in a request.vars

2013-03-29 Thread Tim Richardson
So this works as far as getting my database update going: passing args constructed with the URL helper links = [lambda row: INPUT(_name='toggle',_type="submit",_value="Toggle", _onclick="ajax('%s','' ,':eval')" % URL( 'toggle_order_import',args=[row.id]))]) --