Validation Errors

Hi Railers,

I have put a simple validation

validates_length_of :subject, :maximum => 10, :message => “pick a
shorter subject”

If i have more than 10 characters in subject, the message is not being
sent;
but on the contrary, when i click on send button it says message sent
successfully(a custom message written in Controller) , but in reality it
is not getting sent. Why my message pick a shorter subject is not
getting reflected.

Please advise.

Premanshu

On Nov 12, 6:15am, Premanshu M. [email protected] wrote:

successfully(a custom message written in Controller) , but in reality it
is not getting sent. Why my message pick a shorter subject is not
getting reflected.

Posting some code may help. Are you displaying errors anywhere in your
view? Is the “sent successfully” message only being shown if
validation is successful?

On 12 November 2010 11:15, Premanshu M. [email protected]
wrote:

successfully(a custom message written in Controller) , but in reality it
is not getting sent. Why my message pick a shorter subject is not
getting reflected.

What do you mean by ‘sent’? The validation check is made when the
record is saved to the database not when the form is submitted. I
think maybe you have an error in the controller code that is receiving
the submit.

Colin