Skip to content

errors cummulate when instances of Nette\HtmlStringable #335

Description

@xpavp03

Version: 3.2.3

Bug Description

When errors added to a form or a control are instances of Nette\HtmlStringable they cummulate.

Steps To Reproduce

    $form = new UI\Form;
    $form->addError(Nette\Utils\Html::fromHtml('1'));
    $form->addError(Nette\Utils\Html::fromHtml('2'));

    $renderer = $form->getRenderer();
    assert($renderer instanceof \Nette\Forms\Rendering\DefaultFormRenderer);

    print $renderer->render($form);

renders the second error twice:

<form action="" method="post">

<ul class="error">
	<li>
		1
	</li>

	<li>
		1
	
		2
	</li>
</ul>


</form>

Possible Solution

It seems to be the problem of clonning and addHtml() in DefaultFormRenderer/doRenderErrors().

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions