in fact I was trying it with args as that is usal way choosing a db select set but could not get it to work - (I thought maybe it was because of the way the jpolite js modules work?) so then I seen your code for passing vars to a controller using ajax and tried that aproach. Still on a long learning curve I'm afraid:)
On Jul 11, 7:24 pm, murray3 <ch...@murraypost.net> wrote: > Thanks, I just want to pass the value "other" to the contoller 'm204' > which will then use > logic to decide the db selection set and then render view m204.html > chrism > > On Jul 11, 7:17 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > I cannot tell from the example what this is supposed to do. If you use > > ':eval' ajax expects to recaive a string containing valid js code. > > Your action is returning a serialized table. > > > On Jul 11, 12:53 pm, murray3 <ch...@murraypost.net> wrote: > > > > Massimo, > > > I tried this on following: > > > > view m201 (in jpolite framework) > > > > <dl class="maccordion"> > > > <dt>Prodj Categories:</dt> > > > <dd class="navicon"> > > > <img > > > src="{{=URL(request.application,'static','icon/other.png')}}" > > > id="m204" onclick="ajax('m204',['other'],':eval')" title="Other"/> > > > </dd> > > > </dl> > > > > in controller > > > def m204(): > > > value=request.vars.m204 prodj=db(db.prodj.genus==value).select > > > (db.prodj.id,db.prodj.name,db.prodj.timestamp,orderby=db.prodj.timestamp) > > > return dict(prodj=prodj) > > > > Does not return a selection set, I know the controller db code works, > > > so I guess it's the syntax for the onclick ajax event?? > > > Any help appreciated. > > > Chrism > > > > On Jul 10, 3:20 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > With the latest trunk you can do > > > > > <intput name="value" id="value" /> > > > > <button onclick="ajax('callback',['value'],':eval')">click me</button> > > > > <div id="target"></div> > > > > > def callback(): > > > > value=request.vars.value > > > > return "jQuery('#target').html(%s)" % repr(str(value)) > > > > > when you click the button it sends the value of value to the callback > > > > function. The function returns a jQuery string and the clients runs > > > > it. The trick here is ajax(...,':eval') which is defined by web2py. > > > > > On Jul 10, 8:56 am, Julius Minka <j...@minka.sk> wrote: > > > > > > Hi all, > > > > > > I have a javascript function in html file which is usually called from > > > > > onclick event in the same file. It works fine. > > > > > However I would like to call this javascript function from a > > > > > controller. > > > > > > More precise description: > > > > > after clicking an element in the page, the flow goes to controller. > > > > > There I decide which dialog to display (I have it working to this > > > > > point), but it is defined again in html file as jquery dialog opening > > > > > with .dialog("open"); > > > > > > How to do it? > > > > > Julius > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---