# JavaScript validation

**URL:** <https://www.ruby-forum.com/t/javascript-validation/171507>\
**Category:** Rails\
**Created:** [July 3, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/javascript-validation/171507 "2009-07-03T17:47:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 3, 2009, 5:47pm UTC](https://www.ruby-forum.com/t/javascript-validation/171507/1 "2009-07-03T17:47:38Z")

</div>

Hi Folks,

I’m relatively new to Rails, but am very enamored with it for the most  
part so far. I have a contacts page where the User enters his/her  
personal information. I’m using the server-side validates\_presence\_of,  
and downloaded a plugin that allows me to validate\_date\_time. I would  
like to do some javascript client-side validation, and wonder what the  
ROR approach is to this, as it’s bound to be different (probably much  
nicer) than what I have done in the past. I thought this would show up  
immediately googling, but haven’t found exactly what I was hoping for.

Thanks, Rob

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 4, 2009, 1:40am UTC](https://www.ruby-forum.com/t/javascript-validation/171507/2 "2009-07-04T01:40:14Z")

</div>

Hi Rob,

On Fri, 2009-07-03 at 17:47 +0200, Rob Cash wrote:

> I have a contacts page where the User enters his/her  
> personal information. I’m using the server-side validates\_presence\_of,  
> and downloaded a plugin that allows me to validate\_date\_time. I would  
> like to do some javascript client-side validation, and wonder what the  
> ROR approach is to this, as it’s bound to be different (probably much  
> nicer) than what I have done in the past.

Sorry to disappoint, but Rails is server-side. If you want to do it  
client-side you’re going to have to write some Javascript.

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 4, 2009, 4:39am UTC](https://www.ruby-forum.com/t/javascript-validation/171507/3 "2009-07-04T04:39:45Z")

</div>

Server Side denotes that you are interfacing with a model and a database  
so therefore, validation would be done within the model.

But, if you are needing to do client-side validation within a form that  
is not backed by a model, you need to use javascript validation. And,  
that means you can pretty much use any javascript validation script  
that’s on the net for your purposes. Rails works hand in hand with  
java/ajax…

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 4, 2009, 5:04am UTC](https://www.ruby-forum.com/t/javascript-validation/171507/4 "2009-07-04T05:04:05Z")

</div>

hi,

i also faced the similar problem… long time back… and i ahave used  
jQuery  
plugin for that… so i thought i can help you…  
check out this url  
[bassistance.de » jQuery plugin: Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/)…  
this should do… any quieries i am available online…

On Fri, Jul 3, 2009 at 9:17 PM, Rob Cash

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 4, 2009, 5:32pm UTC](https://www.ruby-forum.com/t/javascript-validation/171507/5 "2009-07-04T17:32:20Z")

</div>

Lakshmi N. wrote:

> hi,
> 
> i also faced the similar problem… long time back… and i ahave used  
> jQuery  
> plugin for that… so i thought i can help you…  
> check out this url  
> [bassistance.de » jQuery plugin: Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/)…  
> this should do… any quieries i am available online…
> 
> On Fri, Jul 3, 2009 at 9:17 PM, Rob Cash

Thanks to all for the replies! … Lakshmi, I’ll give this a try and may  
be back with you for questions.

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 14, 2009, 9:03pm UTC](https://www.ruby-forum.com/t/javascript-validation/171507/6 "2009-07-14T21:03:34Z")

</div>

Lakshmi N. wrote:

> ya sure…
> 
> On Sat, Jul 4, 2009 at 9:02 PM, Rob Cash

Lakshmi … Just wanted to thank you for turning me on to Jquery. All I  
can say is WOW ! This is so much cleaner than classic JavaScripting.

Rob

---

<div class="post-metadata">

**Author:** ![iamdonquixote](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/85e7bf/32.png) [@iamdonquixote](https://www.ruby-forum.com/u/iamdonquixote)\
**Post date:** [July 5, 2009, 4:44am UTC](https://www.ruby-forum.com/t/javascript-validation/171507/7 "2009-07-05T04:44:38Z")

</div>

ya sure…

On Sat, Jul 4, 2009 at 9:02 PM, Rob Cash
