Hi I know with javascript we can validate the input of a form on the client, is there an easy way to specify this in rails? I am thinking the javascript code getting generated using some sort of DSL? -- Kind Regards, Rajinder Yadav SafetyNet Test Driven Development http://safetynet.devmentor.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Mar 4, 2012 at 5:08 PM, Dev Guy <devguy.ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi I know with javascript we can validate the input of a form on the > client, is there an easy way to specify this in rails? I am thinking > the javascript code getting generated using some sort of DSL? >While looking around I did mange to come across these two, however I like the jQuery solution better http://bassistance.de/jquery-plugins/jquery-plugin-validation/ http://livevalidation.com/examples -- Kind Regards, Rajinder Yadav SafetyNet Test Driven Development http://safetynet.devmentor.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sun, Mar 4, 2012 at 6:07 PM, Dev Guy <devguy.ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Sun, Mar 4, 2012 at 5:08 PM, Dev Guy <devguy.ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> Hi I know with javascript we can validate the input of a form on the >> client, is there an easy way to specify this in rails? I am thinking >> the javascript code getting generated using some sort of DSL? >> > > While looking around I did mange to come across these two, however I > like the jQuery solution better > > http://bassistance.de/jquery-plugins/jquery-plugin-validation/ > > http://livevalidation.com/examples >Has anyone got the jquery validator working? I find it''s buggy, when validating password, it''s very obtrusive! I get an error as soon as I type, then it deletes what''s been typed in the password field, which for me if 1 character! -- Kind Regards, Rajinder Yadav SafetyNet Test Driven Development http://safetynet.devmentor.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Have you seen this? http://railscasts.com/episodes/263-client-side-validations On Sunday, March 4, 2012 7:08:34 PM UTC-3, Rajinder Yadav wrote:> > Hi I know with javascript we can validate the input of a form on the > client, is there an easy way to specify this in rails? I am thinking > the javascript code getting generated using some sort of DSL? > > -- > Kind Regards, > Rajinder Yadav > > SafetyNet Test Driven Development > http://safetynet.devmentor.org > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vkYypG-8cBgJ. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Mar 5, 2012 at 7:14 AM, Mohamad El-Husseini <husseini.mel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Have you seen > this? http://railscasts.com/episodes/263-client-side-validations > > > On Sunday, March 4, 2012 7:08:34 PM UTC-3, Rajinder Yadav wrote: >> >> Hi I know with javascript we can validate the input of a form on the >> client, is there an easy way to specify this in rails? I am thinking >> the javascript code getting generated using some sort of DSL? >>Hi Mohamad, thanks I will take a look at this! -- Kind Regards, Rajinder Yadav SafetyNet Test Driven Development http://safetynet.devmentor.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
jQuery(function(){
jQuery(''.ValidField'').each(function(){
jQuery(this).validate({
expression: "if (VAL) return true; else return false;",
message: "Please enter the Required field"
});
});
jQuery(''.ValidInteger'').each(function(){
jQuery(this).validate({
expression: "if (VAL.match(/^[0-9]*$/) && VAL) return true; else
return
false;",
message: "Please enter a valid numeric value"
});
});
jQuery(".ValidDropdown").each(function(){
jQuery(this).validate({
expression: "if (VAL != '''') return true; else return
false;",
message: "Please make a selection"
});
});
//put * on valid fields
//jQuery(''.ValidField'').prev().prev().after(''*'').css(''color'',''#FF0000'');
//prev prev => <label>
jQuery(''.ValidField, .ValidInteger, .RequiredField,
.ValidDropdown,.ValidEmail'').prev().prev().after(''*'');
// for valid emails fields
jQuery(".ValidEmail").each(function(){
jQuery(this).validate({
expression: "if
(VAL.match(/^[^\\W][a-zA-Z0-9\\_\\-\\.]+([a-zA-Z0-9\\_\\-\\.]+)*\\@[a-zA-Z0-9_]+(\\.[a-zA-Z0-9_]+)*\\.[a-zA-Z]{2,4}$/))
return true; else return false;",
message: "Please enter a valid Email ID"
});
});
//for valid date format
jQuery(".ValidDate").each(function(){
jQuery(this).validate({
expression: "if
(!isValidDate(parseInt(VAL.split(''-'')[2]),
parseInt(VAL.split(''-'')[0]),
parseInt(VAL.split(''-'')[1]))) return false;
else return true;",
message: "Please enter a valid Date"
});
});
});
add this jquery in application.js in app/assests/javascript/application.js
and add javascript.validation.js in javascript which i am sending to as an
attachment.hope this will working for you.
On Tue, Mar 6, 2012 at 12:29 AM, Dev Guy
<devguy.ca-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mon, Mar 5, 2012 at 7:14 AM, Mohamad El-Husseini
> <husseini.mel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > Have you seen
> > this? http://railscasts.com/episodes/263-client-side-validations
> >
> >
> > On Sunday, March 4, 2012 7:08:34 PM UTC-3, Rajinder Yadav wrote:
> >>
> >> Hi I know with javascript we can validate the input of a form on
the
> >> client, is there an easy way to specify this in rails? I am
thinking
> >> the javascript code getting generated using some sort of DSL?
> >>
>
> Hi Mohamad, thanks I will take a look at this!
>
> --
> Kind Regards,
> Rajinder Yadav
>
> SafetyNet Test Driven Development
> http://safetynet.devmentor.org
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.