# Javascript validations

**URL:** <https://www.ruby-forum.com/t/javascript-validations/67404>\
**Category:** Rails\
**Created:** [September 4, 2006, 7:48am UTC](https://www.ruby-forum.com/t/javascript-validations/67404 "2006-09-04T07:48:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@dimon](https://www.ruby-forum.com/u/dimon)\
**Post date:** [September 4, 2006, 7:48am UTC](https://www.ruby-forum.com/t/javascript-validations/67404/1 "2006-09-04T07:48:29Z")

</div>

Is there a way of generating client-side javascript validations, maybe  
Unobtrusive Javascript or something like that?

Thanks

---

<div class="post-metadata">

**Author:** ![dimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@dimon](https://www.ruby-forum.com/u/dimon)\
**Post date:** [September 15, 2006, 1:01pm UTC](https://www.ruby-forum.com/t/javascript-validations/67404/2 "2006-09-15T13:01:43Z")

</div>

Hi Dmitry, inspired by your post I’ve put together a small Rails plugin  
that lets you create unobtrusive AJAX validations that hook into your  
model validations, making things nice and dry. If it finds an error  
when you tab out of a field, it adds an “error” class to the field and  
inserts a list of validation errors. It can also take a callback which  
it sends the errors to in JSON format for advanced handling.

There is still some cleaning up to be done but I hope to have something  
out next week.

---

<div class="post-metadata">

**Author:** ![dimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@dimon](https://www.ruby-forum.com/u/dimon)\
**Post date:** [September 15, 2006, 4:33pm UTC](https://www.ruby-forum.com/t/javascript-validations/67404/3 "2006-09-15T16:33:56Z")

</div>

unknown wrote:

> Hi Dmitry, inspired by your post I’ve put together a small Rails plugin  
> that lets you create unobtrusive AJAX validations that hook into your  
> model validations, making things nice and dry. If it finds an error  
> when you tab out of a field, it adds an “error” class to the field and  
> inserts a list of validation errors. It can also take a callback which  
> it sends the errors to in JSON format for advanced handling.
> 
> There is still some cleaning up to be done but I hope to have something  
> out next week.

That’s great, I’ll try your plugin once it is ready

---

<div class="post-metadata">

**Author:** ![dimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@dimon](https://www.ruby-forum.com/u/dimon)\
**Post date:** [October 25, 2006, 11:55pm UTC](https://www.ruby-forum.com/t/javascript-validations/67404/4 "2006-10-25T23:55:57Z")

</div>

unknown wrote:

> Hi Dmitry, inspired by your post I’ve put together a small Rails plugin  
> that lets you create unobtrusive AJAX validations that hook into your  
> model validations, making things nice and dry. If it finds an error  
> when you tab out of a field, it adds an “error” class to the field and  
> inserts a list of validation errors. It can also take a callback which  
> it sends the errors to in JSON format for advanced handling.
> 
> There is still some cleaning up to be done but I hope to have something  
> out next week.

This sounds a lot like what I’ve done for my company a while back.  
I described my approach in detail in “Ajax validation on Rails”, which  
is available at [http://www.bigsmoke.us/ajax-validation-on-rails/](http://www.bigsmoke.us/ajax-validation-on-rails/) if  
you’re  
interested.

I never thought of turning it into a plugin, though. I’m very curious to  
see what you’ll make of it. It sounds like a great idea!

---

<div class="post-metadata">

**Author:** ![dimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/eb8c5e/32.png) [@dimon](https://www.ruby-forum.com/u/dimon)\
**Post date:** [October 26, 2006, 12:24am UTC](https://www.ruby-forum.com/t/javascript-validations/67404/5 "2006-10-26T00:24:53Z")

</div>

On Monday 04 September 2006 07:48, Dmitry H. wrote:

> Is there a way of generating client-side javascript validations,  
> maybe Unobtrusive Javascript or something like that?

Yes:

[http://www.agilewebdevelopment.com/plugins/client\_side\_validation](http://www.agilewebdevelopment.com/plugins/client_side_validation)  
[http://www.agilewebdevelopment.com/plugins/validation\_reflection](http://www.agilewebdevelopment.com/plugins/validation_reflection)

Michael

–  
Michael S.  
[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[http://www.schuerig.de/michael/](http://www.schuerig.de/michael/)
