. . .

How to customize the error message of a validation rule

Published: October 10, 2010

The following validation rule uses an error message that is different from the default one

class Post extends CActiveRecord
{
    public function rules()
    {
        return array(
            array('title, content', 'required',
                  'message'=>'Please enter a value for {attribute}.'),
            // ... other rules
        );
    }
}

 

Source: http://www.yiiframework.com/doc/cookbook/1/

Don't forget to share this post

    Let's Build Digital Excellence Together


    • Cost Efficient Solutions.
    • Minimal Timelines.
    • Effective Communication.
    • High Quality Standards.
    • Lifetime Support.
    • Transparent Execution.
    • 24/7 Availability.
    • Scalable Teams.

    Join Our 200+ Happy Clients Across Globe


    Free Consultation.

      Do you need help in strategy, innovation or growth of your startup/business? Experts from our team will get in touch with you.

      Please do not post jobs/internships inquiries here.