I like your proposal. I will try it tonight and include in trunk.
On Apr 27, 2:09 pm, Skiros <hansen.marc...@gmail.com> wrote: > I am using LOAD function and I have some problems with forms that do > not use a submit button in order to send the data. This is because > web2py_trap_form only catch that type of "INPUT". > > The problem is when a form uses other ways to send the data. For > example "A" or "IMG" tags, and especially when there is some function > to copy or to validate things. > > My proposal is to modify web2py_trap_form to catch the event > "onsubmit" replacing this: > > function web2py_trap_form(... > jQuery('input[type="submit"]',this).click(function(){ > ...) > > with this > > function web2py_trap_form(... > this.onsubmit = function(){ > ...) > > This would allow us to include the function "onsubmit" within any > function that we need to execute before sending the information. And > to make reality things like > > <script> > Function MyFunction(form,name){ > if (name != ""){ > form.onsubmit(); > }} > > </script> > > <form id="myform"> > <input id="name" type="hidden"> > </form> > > <a href="javascript: MyFunction('myform','Skiros');"> > > -- > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en