Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

@Annotation\ErrorMessage not used with Regex validator #4163

Closed
internalsystemerror opened this issue Apr 1, 2013 · 2 comments
Closed

@Annotation\ErrorMessage not used with Regex validator #4163

internalsystemerror opened this issue Apr 1, 2013 · 2 comments

Comments

@internalsystemerror
Copy link

When creating a form the following form annotations:

namespace Application\Form;

use Zend\Form\Annotation as Form;

class AnnotationForm
{
    /**
     * @Form\Name("formProperty")
     * @Form\Type("text")
     * @Form\Options({"label":"Custom form property"})
     * @Form\ErrorMessage("Custom Error Message - 6 digits required")
     * @Form\Validator({"name":"Regex", "options":{"pattern":"/^[\d]{6}$/"}})
     */
    private $formProperty;
}

The "ErrorMessage" property appears not be used and "The input does not match against pattern '/^[\d]{6}$/'" is given as the error message instead. Is this the expected output? In order to change the error message, I have to pass a new messages array as one of the validator options.

ise

@gvelinov
Copy link

You sould do something like this

/**
*  @Annotation\Validator({
"name":"Regex", 
"options":{"pattern":"/^[\d]{6}$/", 
      "messages":{
            "regexInvalid":"Regex is invalid!",
            "regexNotMatch": "Regex not match",
            "regexErrorous": "Internal error!"
       }
}
})
*/

@GeeH
Copy link

GeeH commented Jun 27, 2016

This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html

@GeeH GeeH closed this as completed Jun 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants