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

Form validation for field not possible #11135

Closed
GaiusValerius opened this issue Nov 14, 2015 · 1 comment
Closed

Form validation for field not possible #11135

GaiusValerius opened this issue Nov 14, 2015 · 1 comment
Assignees
Milestone

Comments

@GaiusValerius
Copy link

Hi!
If i try to get the messages for a single field i get nothing, but if i get the messages of the form for the field with "$form->getMessagesFor('xyz')" it works correctly.

Code to reproduce:

// Form field
            $element = $this->add(new Element\Mail('mail'));
            $element->addValidator(
                new Validator\PresenceOf(array(
                    'message' => $this->getDi()->get('translator')->query('front.form.error.PresenceOf'),
                ))
            );

// Controller for example
            $mail = $form->get('mail');
            echo '<pre>';
            var_dump($mail->getMessages()); // Wrong - No messages
            var_dump($form->getMessagesFor('mail')); // Correct - PresenceOf Message
            echo '</pre>';
@sergeyklay sergeyklay added this to the 3.0.3 milestone Dec 20, 2016
@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch. Thanks you

@sergeyklay sergeyklay self-assigned this Dec 24, 2016
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

2 participants