Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation rules for min width and height for an image only required when creating a model #22

Open
davidluuAU opened this issue Apr 2, 2013 · 0 comments

Comments

@davidluuAU
Copy link

I want an image to only be required when a user is creating a model. I also want the image to have a certain minimum width and height. If a user updates a model, they will not need to select an image again, but if they do, the same validation rule for minimum width and height is applied.

I am encountering an issue when updating a model and I dont set an image. The minimum width and height validation rules is always triggered, even though the image is not required. Am I setting the validation rules correctly? What validation rules should I use?

The validation rules I am using are as follows:

'image' => array(

    'required' => 'create',

    'minWidth' => array(
            'rule' => array('minWidth', '680'),
            'message' => 'Photo must be at least 680 pixels wide'
    ),
    'minHeight' => array(
            'rule' => array('minHeight', '460'),
            'message' => 'Photo must be at least 460 pixels tall'
    )

),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant