We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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 messages, up to the #12466 PR, were added in sorted form (by element name) to the Phalcon\Forms\Form stack.
Phalcon\Forms\Form
Messages generated by all the elements in the form were joined by default so they can be traversed by a single foreach.
foreach
if (!$form->isValid($_POST)) { $messages = $form->getMessages(); // Default behavior // $messages is a Phalcon\Validation\Message\Group object foreach ($messages as $message) { echo $message, "<br>"; } }
The user could change this behavior to get the messages separated by the field.
foreach ($form->getMessages(true) as $attribute => $messages) { echo "Messages generated by ", $attribute, ":", "\n"; // $messages is an array of Phalcon\Validation\Message\Group objects foreach ($messages as $message) { echo $message, "<br>"; } }
In the #12466 PR, this behavior was been broken.
// cc @mbrostami
The text was updated successfully, but these errors were encountered:
@sergeyklay I fixed that in : #13295 But I suggest to remove that part, in next major version.
I prefer to use:
$elements = $form->getElements(); foreach ($elements as $element) { echo "Messages generated by ", $element->getName(), ":", "\n"; foreach ($form->getMessagesFor($element->getName())) as $message) { echo $message, "<br>"; }; }
Sorry, something went wrong.
sergeyklay
No branches or pull requests
Validation messages, up to the #12466 PR, were added in sorted form (by element name) to the
Phalcon\Forms\Form
stack.Messages generated by all the elements in the form were joined by default so they can be traversed by a single
foreach
.The user could change this behavior to get the messages separated by the field.
In the #12466 PR, this behavior was been broken.
// cc @mbrostami
The text was updated successfully, but these errors were encountered: