After some more digging, it would seem the problem with the file upload failing may be that multipart forms cannot be submitted via ajax. Given that file upload is a very common feature of forms, and that forms are very common implementations of a partial (as shown in the jDiv demos), not having file upload within a jDiv form would limit it's usefulness.
jQuery already has an ajax form plugin that can handle file uploads in ajax forms by using a hidden iframe. Since web2py is already using jQuery would it make sense to incorporate this plugin as part of the jDiv functionality for submitting forms? Incorporating this plugin would also open the door to other form behavior customizations on the client side such as progress meters, etc, which would also be very useful. Ted On May 1, 4:29 pm, Ted G <[email protected]> wrote: > That is how I've resorted to for now as well (with the exception of > the file upload part of my form not working as mentioned at start of > this thread). > > Your example is a good one and similar to my own. Using your example, > I want to be able to re-use the FormjDiv partial in other pages of the > site. It is hard to re-use FormjDiv when it is coupled to HoursjDiv on > the controller side (as a result of FormjDiv refreshing HoursjDiv). > Ideally, I would want to have FormjDiv trigger a Javascript function, > either a specific named one I provide, or have it always call a > generic function - eg. jDivLoadSuccess(target) that I can implement on > the client side to take action. > > In the generic case, thejDiv, upon successful submission would call > jDivLoadSuccess(target) passing its own target_id. I could then use > this to determine what action just took place and what action to take > next. In your example, if this function was called as a result of > target_FormjDiv submitting, then I would call jDivLoad > ("target_HoursjDiv", myURL, null) to force a load of HoursJDiv. I > could also then hide FormJDiv, refresh it, and any other actions I > wish to take. > > Not being forced to couplejDivbehavior together on the server side, > opens up much better scenarios for customizing interaction betweenjDiv'sand > re-use of thosejDiv's. > > On May 1, 3:59 pm, Wes James <[email protected]> wrote: > > > Right now with my time tracker i have: > > > FormjDiv > > HoursjDiv > > Last20itemsjDiv > > > When I submit FormjDiv it goes away (the lower part of thejDiv), but it > > refreshes HoursjDiv on the callback. At the end of the code for HoursjDiv i > > have it trigger FormjDiv to open it up again with a new form (like click the > > first top button) and also to refresh contents in Last20itemsjDiv. > > > There's probably a better way to do this, but this works for now. > > > -wj > > > On Fri, May 1, 2009 at 4:52 PM, Ted G <[email protected]> wrote: > > > > On a related note: > > > > What is the best way to trigger a Javascript function upon ajDivload > > > or form submit within ajDiv? For example: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

