# Override Validation?

**URL:** <https://www.ruby-forum.com/t/override-validation/51126>\
**Category:** Rails\
**Created:** [December 26, 2005, 10:53pm UTC](https://www.ruby-forum.com/t/override-validation/51126 "2005-12-26T22:53:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nmk](https://www.ruby-forum.com/u/nmk)\
**Post date:** [December 26, 2005, 10:53pm UTC](https://www.ruby-forum.com/t/override-validation/51126/1 "2005-12-26T22:53:47Z")

</div>

Hi all,

is there a way to override the validation methods so as to avoid the  
div.fieldWithErrors divs from being created on the redisplayed form?

Many thanks in advance,  
Nicky

---

<div class="post-metadata">

**Author:** ![nmk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nmk](https://www.ruby-forum.com/u/nmk)\
**Post date:** [December 26, 2005, 11:51pm UTC](https://www.ruby-forum.com/t/override-validation/51126/2 "2005-12-26T23:51:05Z")

</div>

On Monday 26 Dec 2005 21:51, Nickolay K. wrote:

> Hi all,  
> is there a way to override the validation methods so as to avoid the  
> div.fieldWithErrors divs from being created on the redisplayed form?  
> Many thanks in advance,  
> Nicky

Hi Nicky,

Firstly, I have to ask: why do you want to do that? Not because I think  
you  
shouldn’t do that, but because I’m trying to work out what your scenario  
is.

Would I be right that you’re doing a multi-stage form, and so you only  
want to  
validate certain things at each stage?

If so, maybe this thread will help:  
[http://thread.gmane.org/gmane.comp.lang.ruby.rails/27712](http://thread.gmane.org/gmane.comp.lang.ruby.rails/27712)

Particularly:  
[http://article.gmane.org/gmane.comp.lang.ruby.rails/27758](http://article.gmane.org/gmane.comp.lang.ruby.rails/27758)

Any good for what you’re trying to do?

Cheers,

~Dave

–

Dave S.  
Rent-A-Monkey Website Development  
Web: [http://www.rentamonkey.com/](http://www.rentamonkey.com/)

---

<div class="post-metadata">

**Author:** ![nmk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nmk](https://www.ruby-forum.com/u/nmk)\
**Post date:** [December 27, 2005, 4:57am UTC](https://www.ruby-forum.com/t/override-validation/51126/3 "2005-12-27T04:57:57Z")

</div>

Nickolay K. wrote:

> Hi all,
> 
> is there a way to override the validation methods so as to avoid the  
> div.fieldWithErrors divs from being created on the redisplayed form?

If I understand you correctly, a better approach would  
probably be to disable the error reporting either by  
clearing the error data from the object (#errors),  
modifying the templates, writing your own error display  
code or by just sticking an extra style tag there with  
display: hide; for those divs.

If you DO need to disable validation, Validations provides  
#save\_with\_validation to which you can give false as a parameter  
to turn validation off but use this one with caution and  
preferrably for system-generated data only.

> Many thanks in advance,  
> Nicky

E

---

<div class="post-metadata">

**Author:** ![nmk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nmk](https://www.ruby-forum.com/u/nmk)\
**Post date:** [December 28, 2005, 11:18am UTC](https://www.ruby-forum.com/t/override-validation/51126/4 "2005-12-28T11:18:37Z")

</div>

> Firstly, I have to ask: why do you want to do that? Not because I  
> think you  
> shouldn’t do that, but because I’m trying to work out what your  
> scenario is.

It was actually for a much simpler goal: I had to avoid a block  
element around my input fields. But the form got redesigned anyway,  
so this was solved another way.

Thanks for the suggestions though!

Cheers,  
– Nicky
