I want to use onsubmit for a form validation using javascript on remote_form_for for this i am doing something like this <% remote_form_for :timesheet, @timesheet, :url =>{:action => ''report_user''}, :html => {:onsubmit=>"return ValidateDate();" } do |f| %> // Form elements here <% end %> but it not works well. if condition return false then my form is not get submitted this is exactly what i want but when it returns true it produce something like this o/p on UI. Element.update("user_report", "\n\n\u003Ctable class=\"list issues\"\u003E\n \u003Cthead\u003E\u003Ctr\u003E\n \u003Cth\u003E#\u003C/th\u003E\n when i delete :html code it works fine. Regards, Salil -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org
2009-Mar-10 07:16 UTC
Re: onsubmit for remote_form_for not working properly
On 10 Mar., 06:20, Salil Gaikwad <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I want to use onsubmit for a form validation using javascript on > remote_form_for<snip>> but it not works well. if condition return false then my form is not get > submitted this is exactly what i want but when it returns true it > produce something like this o/p on UI. > > Element.update("user_report", "\n\n\u003Ctable class=\"list > issues\"\u003E\n \u003Cthead\u003E\u003Ctr\u003E\n > \u003Cth\u003E#\u003C/th\u003E\nI guess this is a JavaScript issue. What about showing us that? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> <% remote_form_for :timesheet, @timesheet, :url =>{:action => > ''report_user''}, :html => {:onsubmit=>"return ValidateDate();" } do |f| > %>> I guess this is a JavaScript issue. What about showing us that?Thanx 4 ur reply No i am just telling what problem i m facing. i just want to know is onsubmit working properly with remote_form_for? and wheather there is any syntax error in my code above ? Regards, Salil -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org
2009-Mar-17 15:01 UTC
Re: onsubmit for remote_form_for not working properly
On 10 Mar., 08:29, Salil Gaikwad <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > <% remote_form_for :timesheet, @timesheet, :url =>{:action => > > ''report_user''}, :html => {:onsubmit=>"return ValidateDate();" } do |f| > > %> > > I guess this is a JavaScript issue. What about showing us that? > > Thanx 4 ur reply > > No i am just telling what problem i m facing. > i just want to know is onsubmit working properly with remote_form_for? > and wheather there is any syntax error in my code above ?No, remote_form_for will use the onsubmit event to make the actual AJAX request. So I don''t think overriding the onsubmit attribute would be a good idea... :) -- Cheers, David Knorr http://twitter.com/rubyguy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> No, remote_form_for will use the onsubmit event to make the actual > AJAX request. So I don''t think overriding the onsubmit attribute would > be a good idea... :) >thanx @David. Do you know what should do in that case to put javascript form validations? Thanx & Regards Salil -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-17 16:35 UTC
Re: onsubmit for remote_form_for not working properly
On Mar 17, 4:17 pm, Salil Gaikwad <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > No, remote_form_for will use the onsubmit event to make the actual > > AJAX request. So I don''t think overriding the onsubmit attribute would > > be a good idea... :) > > thanx @David. > Do you know what should do in that case to put javascript form > validations?The ajax helpers can take a :conditions parameter which is a fragment of javascript to run to check whether the request should go ahead (it''s described in the docs for link_to_remote) Fred> > Thanx & Regards > Salil > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---