Got it. I deleted the default contents that were generated when I created the function1.load file. I thought it was all commented out but the last line was not:
{{if len(response._vars)==1:}}{{=response._vars.values()[0]}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}} I removed this line and now only what I expected is show in the view. Thanks On Monday, April 15, 2013 12:15:55 PM UTC-4, Anthony wrote: > > If your function returns a dict, the dict never gets sent directly to the > browser -- it will always call a view in that case. If there is no > dedicated view, then it will try the generic view if enabled, and if not, > you will get an error. The generic view creates a table showing all the > items in the dict using the BEAUTIFY() helper. Can you show the content of > your function1.load view? > > Anthony > > On Monday, April 15, 2013 11:08:50 AM UTC-4, Stephen McCamy wrote: >> >> Got it, thanks! The last thing is how do I get only the function1.load >> to insert into myid and not the returned dict of function1 as well. It >> does both right now. >> >> {{=A('link',_href='#', _onclick="jQuery(this).fadeOut(); \ >> web2py_component('%s', 'myid'); return false;" % URL('default', >> 'function1.load', vars=dict(s=parameter)))}} >> >> >> On Monday, April 15, 2013 10:41:12 AM UTC-4, Anthony wrote: >>> >>> You can create a function1.load view and call URL('default', >>> 'function1.load'), and then do whatever you want in the function1.load >>> view. For example: >>> >>> /controllers/default.py: >>> def function1(): >>> ... >>> return dict(timestamp=timestamp, url=url) >>> >>> /views/default/function1.load: >>> {{=timestamp}} >>> <a href="{{=url}}">click me</a> >>> >>> The HTML generated by the function1.load view will be inserted into the >>> 'myid' div. >>> >>> Anthony >>> >>> On Monday, April 15, 2013 10:32:18 AM UTC-4, Stephen McCamy wrote: >>>> >>>> This works. So can I manipulate certain elements of the returned >>>> function1 dictionary in the view before or as they are loaded into 'myid'? >>>> Basically, my function1 returns a timestamp and a hyperlink as a result. >>>> I >>>> want to be able to make the returned url a hyperlink as well. Plus as >>>> I continue I am sure I will have a need to change returned values. >>>> >>>> Thanks >>>> >>>> On Wednesday, April 10, 2013 10:00:06 AM UTC-4, Anthony wrote: >>>>> >>>>> Note, you should probably use the URL() helper instead of hard-coding >>>>> the URL: >>>>> >>>>> A('Link', _href="#" _onclick="jQuery(this).fadeOut(); \ >>>>> web2py_component('%s' <http://localhost/app/function1.html/?s=>, >>>>> 'myid'); return false;" % URL('default', 'function1', vars=dict(s= >>>>> parameter))) >>>>> >>>>> Anthony >>>>> >>>>> On Wednesday, April 10, 2013 9:27:56 AM UTC-4, Stephen McCamy wrote: >>>>>> >>>>>> That works perfect! Yes, I didn't include the actual URL and I was >>>>>> unclear that it is a python variable that I am passing. This works >>>>>> great! >>>>>> Thanks so much! >>>>>> >>>>>> On Wednesday, April 10, 2013 9:09:28 AM UTC-4, Anthony wrote: >>>>>>> >>>>>>> It works for me. Perhaps your URL isn't returning anything -- are >>>>>>> you sure 'http://localhost/app/function1.html/?s=' + parameter >>>>>>> generates >>>>>>> the correct URL and returns the expected output? In particular, the >>>>>>> "parameter" variable should be a previously defined Javascript variable >>>>>>> -- >>>>>>> does it exist? Or is it supposed to be a Python variable, in which case >>>>>>> the >>>>>>> code would be: >>>>>>> >>>>>>> A('Link', _href="#" _onclick="jQuery(this).fadeOut(); \ >>>>>>> >>>>>>> web2py_component('http://localhost/app/function1.html/?s=%s'<http://localhost/app/function1.html/?s=>, >>>>>>> >>>>>>> 'myid'); \ >>>>>>> return false;" % parameter) >>>>>>> >>>>>>> Note, I also added a dummy _href above so the link will appear >>>>>>> clickable on the page. >>>>>>> >>>>>>> Anthony >>>>>>> >>>>>>> On Wednesday, April 10, 2013 8:56:03 AM UTC-4, Stephen McCamy wrote: >>>>>>>> >>>>>>>> Ok, that makes sense. So how can you write it so the web2py >>>>>>>> component will not only fade out but will load into a specified id >>>>>>>> in the >>>>>>>> DIV as as well? The example you provided forces the link to fadeout >>>>>>>> but no >>>>>>>> longer loads the div (which makes sense). I want to do both. This is >>>>>>>> good information thank you! >>>>>>>> >>>>>>>> On Tuesday, April 9, 2013 11:11:13 PM UTC-4, Stephen McCamy wrote: >>>>>>>>> >>>>>>>>> Hello, >>>>>>>>> >>>>>>>>> I am trying to add a jQuery effect to my A helper below. I am not >>>>>>>>> stuck on using the A helper but it works well so that is what I am >>>>>>>>> doing. >>>>>>>>> Below passes a parameter to a function and the results are loaded >>>>>>>>> into the >>>>>>>>> div when the function finishes. I want to indicate to the user that >>>>>>>>> the >>>>>>>>> link has been clicked because the function takes some time to >>>>>>>>> process. I >>>>>>>>> think the usage of fadeout() in this example: {{=DIV('click >>>>>>>>> me!', _onclick="jQuery(this).fadeOut()")}} from the documentation >>>>>>>>> would be fine but it does not work when I add it to the A helper >>>>>>>>> below. It >>>>>>>>> just stays the same. I assume this is because the A helper overrides >>>>>>>>> the >>>>>>>>> jQuery somehow and treats the object as a hyperlink no matter what. I >>>>>>>>> am >>>>>>>>> really stuck on this. Any input would be useful. Thanks! >>>>>>>>> >>>>>>>>> {{=A(''Link', _href=' >>>>>>>>> http://localhost/app/function1.html/?s='+parameter, cid='myid')}} >>>>>>>>> <div id="myid" URL></div> >>>>>>>>> >>>>>>>>> I tried: >>>>>>>>> >>>>>>>>> {{=A(''Link', _onclick="jQuery(this).fadeOut()", _href=' >>>>>>>>> http://localhost/app/function1.html/?s='+parameter, cid='myid')}} >>>>>>>>> <div id="myid" URL></div> >>>>>>>>> >>>>>>>>> with no luck. >>>>>>>>> >>>>>>>> -- --- 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/groups/opt_out.