Override Validation?


#1

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


#2

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/


#3

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


#4

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