Hard to debug but I think something is wrong here.. $("form").each(function(){ var submitButton = $(this).find("input[type='submit']"); $(submitButton).bind("click", function(e){ ... $("form").each(function(i){ ...
for each form in page, find the submit button and bind to click a function that (again) loops on each form. Why? The function should only act on the cuurrent form (this). I do not think there should be two nested $('form').each(...). On Jan 23, 9:12 pm, ionel <ionelanton...@gmail.com> wrote: > @massimo > I have a jQuery solution that show the errors on validation with one > submit and multiple forms. > Anyway, I have one problem: for a second POST, despite the modified > data to post to the server, the second response is identical to the > first response. > I don't know if this is a jQuery or a web2py problem. Can you help me, > please? > > Thank you very much. > > ionel > > <script language="javascript" type="text/javascript"> > $(document).ready(function(){ > $("form").each(function(){ > var submitButton = $(this).find("input[type='submit']"); > $(submitButton).bind("click", function(e){ > e.preventDefault(); > $("form").each(function(i){ > var selected_form = $(this); > var data_to_send = selected_form.serialize(); > //alert(data_to_send); > $.ajax({ > cache: false, > type: "POST", > //url: "{{=URL(request.application, 'administration', 'members', > args='add')}}", > data: data_to_send, > success: function(response){ > var resp_form = $(response).find("form").eq(i); > // !!!! DESPITE MODIFIED data_to_send, A SECOND POST SEND THE > SAME response !!!! > //alert("RESPONSE: \n\n\n:" + resp_form.html()); > $(selected_form).find("tr").each(function(){ > if ($(this).attr("id") != "submit_record__row") { > var tr_obj = $(this); > $(tr_obj).find("td").each(function(){ > var el_name = $(this).children().attr("name"); > var element_error = $(resp_form).find("[id='" + el_name + > "__error']"); > if (null != element_error) { > $(this).children().after(element_error); > } else { > //TODO: remove the message errors for validated fields > $(this).parent().find("[id='" + element_id + > "__error']").remove(); > } > }); > } > }); > }, > error: function(){ > alert("Error..."); > } > }); > }); > }); > });}); > > </script> > > On Jan 19, 2:47 pm, Thadeus Burgess <thade...@thadeusb.com> wrote: > > > Cant you change it to use SQLFORM.factory instead of crud?? > > > -Thadeus > > > On Tue, Jan 19, 2010 at 7:42 AM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > The plugin sends one post after the other via ajax. The accept > > > mechanism should work in this case but I how do you handle errors in > > > this case? The JS in the link does not contemplate the possibility > > > that the posts do not validate. > > > > On Jan 19, 5:55 am, ionel <ionelanton...@gmail.com> wrote: > > >> No, because I create the forms with crud from 3 related tables. > > > >> I found a jQuery solution > > >> at:http://stackoverflow.com/questions/315912/posting-submitting-multiple... > > > >> but I'd like to know if web2py itself has a mechanism to do that. > > > >> Thank you. > > > >> On Jan 18, 11:16 pm, Jason Brower <encomp...@gmail.com> wrote: > > > >> > Couldn't you put all of them under one form? > > > >> > On Mon, 2010-01-18 at 19:59 -0800, ionel wrote: > > >> > > Hello, > > > >> > > I have multiple forms (multiple submit buttons) and I need to submit > > >> > > all forms when I click any submit button. > > >> > > Is it possible? > > > >> > > Thank you. > > > >> > > i.a. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "web2py-users" group. > > > To post to this group, send email to web...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > web2py+unsubscr...@googlegroups.com. > > > For more options, visit this group > > > athttp://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.