Forum: Ruby on Rails Override Validation?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Nickolay K. (Guest)
on 2005-12-26 23:53
(Received via mailing list)
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
Dave S. (Guest)
on 2005-12-27 00:51
(Received via mailing list)
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

Particularly:
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/
Eero S. (Guest)
on 2005-12-27 05:57
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
Nickolay K. (Guest)
on 2005-12-28 12:18
(Received via mailing list)
> 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
This topic is locked and can not be replied to.