Jatinder Singh
2006-Aug-29 05:38 UTC
Javascript form validation for In place editting in scriptaculous ?
Is there a way by which I can do form validation for form generated by In Place Editting of scritaculous? The reason is, I want to avoid server roundtrip for checks which I can perform at browser. Regards, Jatinder --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pratik
2006-Aug-29 06:01 UTC
Re: Javascript form validation for In place editting in scriptaculous ?
Override the default method called by in_place_edit : If you have <%= in_place_editor_field :object, :attribute %> Define the following in your controller : private def set_object_attribute - find by id - update attribute - render :text => @object.attribute end This will perform the validation, but won''t display the errors however. You might want to play around with RJS to do so. -Pratik On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > Is there a way by which I can do form validation for form generated by In > Place Editting of scritaculous? > The reason is, I want to avoid server roundtrip for checks which I can > perform at browser. > > > Regards, > > Jatinder > > > > >-- rm -rf / 2>/dev/null - http://null.in Dont judge those who try and fail, judge those who fail to try.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pratik
2006-Aug-29 06:02 UTC
Re: Javascript form validation for In place editting in scriptaculous ?
Found this. http://rails.techno-weenie.net/question/2006/7/17/how-do-i-extend-the-rails-code-to-do-what-i-want On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Override the default method called by in_place_edit : > > If you have <%= in_place_editor_field :object, :attribute %> > > Define the following in your controller : > > private > def set_object_attribute > - find by id > - update attribute > - render :text => @object.attribute > end > > This will perform the validation, but won''t display the errors > however. You might want to play around with RJS to do so. > > -Pratik > > On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > Is there a way by which I can do form validation for form generated by In > > Place Editting of scritaculous? > > The reason is, I want to avoid server roundtrip for checks which I can > > perform at browser. > > > > > > Regards, > > > > Jatinder > > > > > > > > > > > > > -- > rm -rf / 2>/dev/null - http://null.in > > Dont judge those who try and fail, judge those who fail to try.. >-- rm -rf / 2>/dev/null - http://null.in Dont judge those who try and fail, judge those who fail to try.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jatinder Singh
2006-Aug-29 06:28 UTC
Re: Javascript form validation for In place editting in scriptaculous ?
Thanks for sharing the link Pratik. The link explains how do I extend rails code to perform certain validations for in place editing control at server side; I am looking for performing validations at client side. for e.g. <form action="submitpage.htm" onsubmit="return validate_form(this)" method="post"> Email: <input type="text" name="email" size="30"> <input type="submit" value="Submit"> </form> On submission of above form, validate_form javascript method should be called to perform javascript form validation, only then form should be submitted. I was wondering if scriptaculous IPE allows that? something like onSubmitFormValidate as one of the options argument in IPE would have been great. Regards, Jatinder On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Found this. > > > http://rails.techno-weenie.net/question/2006/7/17/how-do-i-extend-the-rails-code-to-do-what-i-want > > On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Override the default method called by in_place_edit : > > > > If you have <%= in_place_editor_field :object, :attribute %> > > > > Define the following in your controller : > > > > private > > def set_object_attribute > > - find by id > > - update attribute > > - render :text => @object.attribute > > end > > > > This will perform the validation, but won''t display the errors > > however. You might want to play around with RJS to do so. > > > > -Pratik > > > > On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Is there a way by which I can do form validation for form generated by > In > > > Place Editting of scritaculous? > > > The reason is, I want to avoid server roundtrip for checks which I can > > > perform at browser. > > > > > > > > > Regards, > > > > > > Jatinder > > > > > > > > > > > > > > > > > > > > -- > > rm -rf / 2>/dev/null - http://null.in > > > > Dont judge those who try and fail, judge those who fail to try.. > > > > > -- > rm -rf / 2>/dev/null - http://null.in > > Dont judge those who try and fail, judge those who fail to try.. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Pratik
2006-Aug-29 06:58 UTC
Re: Javascript form validation for In place editting in scriptaculous ?
I usually never perform client side validation. As it can be fooled easily, and you might end up with a lot of junk code in your database. So, even if you''re doing client side validation, server side validation is a must. Try looking into unobtrusive js plugin. That might be useful. Thanks, Pratik On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks for sharing the link Pratik. > The link explains how do I extend rails code to perform certain validations > for in place editing control at server side; I am looking for performing > validations at client side. > for e.g. > <form action="submitpage.htm" > onsubmit="return validate_form(this)" > method="post"> > Email: <input type="text" name="email" size="30"> > <input type="submit" value="Submit"> > </form> > > On submission of above form, validate_form javascript method should be > called to perform javascript form validation, only then form should be > submitted. > I was wondering if scriptaculous IPE allows that? something like > onSubmitFormValidate as one of the options argument in IPE would have been > great. > > Regards, > > Jatinder > > > > > > On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Found this. > > http://rails.techno-weenie.net/question/2006/7/17/how-do-i-extend-the-rails-code-to-do-what-i-want > > On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Override the default method called by in_place_edit : > > > > If you have <%= in_place_editor_field :object, :attribute %> > > > > Define the following in your controller : > > > > private > > def set_object_attribute > > - find by id > > - update attribute > > - render :text => @object.attribute > > end > > > > This will perform the validation, but won''t display the errors > > however. You might want to play around with RJS to do so. > > > > -Pratik > > > > On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > Is there a way by which I can do form validation for form generated by > In > > > Place Editting of scritaculous? > > > The reason is, I want to avoid server roundtrip for checks which I can > > > perform at browser. > > > > > > > > > Regards, > > > > > > Jatinder > > > > > > > > > > > > > > > > > > > > -- > > rm -rf / 2>/dev/null - http://null.in > > > > Dont judge those who try and fail, judge those who fail to try.. > > > > > -- > rm -rf / 2>/dev/null - http://null.in > > Dont judge those who try and fail, judge those who fail to try.. > > > > > >-- rm -rf / 2>/dev/null - http://null.in Dont judge those who try and fail, judge those who fail to try.. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jatinder Singh
2006-Aug-29 07:23 UTC
Re: Javascript form validation for In place editting in scriptaculous ?
Yes I would definately add validations at server level too. I will look through unobtrusive js plugin. Thanks! -Jatinder On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I usually never perform client side validation. As it can be fooled > easily, and you might end up with a lot of junk code in your database. > So, even if you''re doing client side validation, server side > validation is a must. > > Try looking into unobtrusive js plugin. That might be useful. > > Thanks, > Pratik > > On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Thanks for sharing the link Pratik. > > The link explains how do I extend rails code to perform certain > validations > > for in place editing control at server side; I am looking for performing > > validations at client side. > > for e.g. > > <form action="submitpage.htm" > > onsubmit="return validate_form(this)" > > method="post"> > > Email: <input type="text" name="email" size="30"> > > <input type="submit" value="Submit"> > > </form> > > > > On submission of above form, validate_form javascript method should be > > called to perform javascript form validation, only then form should be > > submitted. > > I was wondering if scriptaculous IPE allows that? something like > > onSubmitFormValidate as one of the options argument in IPE would have > been > > great. > > > > Regards, > > > > Jatinder > > > > > > > > > > > > On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > Found this. > > > > > http://rails.techno-weenie.net/question/2006/7/17/how-do-i-extend-the-rails-code-to-do-what-i-want > > > > On 8/29/06, Pratik <pratiknaik-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Override the default method called by in_place_edit : > > > > > > If you have <%= in_place_editor_field :object, :attribute %> > > > > > > Define the following in your controller : > > > > > > private > > > def set_object_attribute > > > - find by id > > > - update attribute > > > - render :text => @object.attribute > > > end > > > > > > This will perform the validation, but won''t display the errors > > > however. You might want to play around with RJS to do so. > > > > > > -Pratik > > > > > > On 8/29/06, Jatinder Singh <jatinder.saundh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > > > > Is there a way by which I can do form validation for form generated > by > > In > > > > Place Editting of scritaculous? > > > > The reason is, I want to avoid server roundtrip for checks which I > can > > > > perform at browser. > > > > > > > > > > > > Regards, > > > > > > > > Jatinder > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > rm -rf / 2>/dev/null - http://null.in > > > > > > Dont judge those who try and fail, judge those who fail to try.. > > > > > > > > > -- > > rm -rf / 2>/dev/null - http://null.in > > > > Dont judge those who try and fail, judge those who fail to try.. > > > > > > > > > > > > > > -- > rm -rf / 2>/dev/null - http://null.in > > Dont judge those who try and fail, judge those who fail to try.. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jatinder Singh
2006-Nov-04 02:57 UTC
[Rails] Javascript form validation for In place editting in scriptaculous ?
Is there a way by which I can do form validation for form generated by In Place Editting of scritaculous? The reason is, I want to avoid server roundtrip for checks which I can perform at browser. Regards, Jatinder -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060828/ca882668/attachment-0001.html