[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-24 Thread bracquet
Yeah, I'll try your suggestion and see what happens: {{=A('click for more information', _href=URL("search_results", args=[ 'myCallback', 1]))}} On Friday, May 24, 2013 1:51:59 PM UTC-4, Anthony wrote: > > So why not use a single function (e.g., search_results), and just pass all > the other inf

[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-24 Thread bracquet
I wanted to display a resultset using the same view template. To be more specific, we can take an online store example: A navbar will consist of several main links which are categories. A list of subcategory links will show up if you hover over a category link. When a user clicks on a subcatego

[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-24 Thread bracquet
Thanks, however I just noticed in the original code that I had incorrectly written the callback function as "myButton()". It should have been "myCallback()". I modified the code: def search_results(): div = DIV(.) response.view = 'default/search_results.html' return dict(div=div)

[web2py] Re: Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread bracquet
search_results() will have to be exposed since I want to display the results on a different page (in search_results.html). I think returning the div using your suggestion would still be on the same page? On Thursday, May 23, 2013 3:38:17 PM UTC-4, Anthony wrote: > > Why do you need to redirect

[web2py] Redirect to another controller function with arguments from a callback function?

2013-05-23 Thread bracquet
In my views, I have: {{=A('click for more information', _href=URL("myCallback", args=[1]))}} When the anchor button is clicked, my callback will do some lookup and processing in the db, and then will redirect to a new page populated with the new information: def search_results(): resultSe

[web2py] Re: Please explain how this query works

2013-05-21 Thread bracquet
Hm, but how does it know to return a set object from the product_filter table rather than the product or filter table? And what does these two queries mean when it comes executing the queries? (db.products.id == db.product_filter.product_id) & (db.filters.id == db.product_filter.filter_id

[web2py] Please explain how this query works

2013-05-21 Thread bracquet
Is there a section in the online web2py book that explains Niphlod's way to building a query? Near the bottom of this thread there is: all_in_one = db( (db.products.id == db.product_filter.product_id) & (d

[web2py] Re: How to build a db query for a many-to-many table given multiple constraints?

2013-05-14 Thread bracquet
Thanks, I'll give it a try. On Saturday, May 11, 2013 8:17:58 AM UTC-4, Niphlod wrote: > > ok. it adds a layer on top. Basically you want to have all products > matching all product_filters that have AT LEAST 2 rows for the same product. > > here we go. > > myfilter = ("top", "sweatshirt") > top_

[web2py] Re: How to build a db query for a many-to-many table given multiple constraints?

2013-05-10 Thread bracquet
Thanks for your patience. That's neat. I didn't know you could declare a linkage table like that. I don't think that scenario would fit into what I'm thinking. Please let me rephrase my example scenario. What about this scenario: id name 1 "foo" 2 "bar" 3 "hello" 4 "world" and filt

[web2py] Re: How to build a db query for a many-to-many table given multiple constraints?

2013-05-10 Thread bracquet
Hm.. Maybe I'm not understanding something. I thought the standard way of creating a many to many relationship was to create a table which holds the ids of the two things you're creating a relationship with. With this example, db.define_table('products', Field('name')) db.define_tab

[web2py] How to build a db query for a many-to-many table given multiple constraints?

2013-05-10 Thread bracquet
How do I search for all products of a certain combination of filters in a many to many relationship? The products returned have to at least have the filters given. For example, if I had this many to many relationship: db.define_table('thefilter_products', Field('product', db.products),

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
Sorry, I had a typo in the last email: I meant to write "doPost()" and not "do Post()" On Tuesday, May 7, 2013 3:00:57 PM UTC-4, brac...@gmail.com wrote: > > I thought maybe this was an asynchronous problem or something similar, so > I modified the util.js to do this: > > function do Post(callba

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
I thought maybe this was an asynchronous problem or something similar, so I modified the util.js to do this: function do Post(callback, data) { $.post(callback, data).then(doSuccess, doFail); function doSuccess(data) { alert('Success!'); } function doFail(data) { alert('Failed!'); }

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
I think something odd is going on. The Failed message never appears if I set breakpoints and step through the javascript in firebug. When I do this, I can see that the eventual post request has a status 200, but no success message is ever alerted. If I remove the breakpoints and let the program

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
No, add_item doesn't have an associated view with it. I tried doing just a "return" and also tried omitting the return statement entirely. jquery still tells me it's failed. On Monday, May 6, 2013 5:33:04 PM UTC-4, Anthony wrote: > > 1. For some reason every click results in a javascript alert

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
the plugin-clientapi seems neat. I kind of want to get my hands dirty by doing things myself first, but I'll definitely look into the plugin. Thanks! -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-07 Thread bracquet
I'm not familiar with website design, so I wrote the util.js because I thought it might make things a bit simpler to handle. If I wanted a delete function, I would just add that in util.js and call the doPost() with the correct callback function. The doPost() would pass that to the respective c

[web2py] Re: Passing javascript data to web2py controller using json?

2013-05-06 Thread bracquet
Thanks Anthony, I had to move all the web2py tags out of the static util.js and I put them in inside the view html. The quotes was the problem. I can call my controller now and I see the json that was passed to it, which is great. The current views code now looks like this: