Skip to content

addHtml on button stopped working #276

@tomolas

Description

@tomolas

Version: 3.1.4

Bug Description

Setting custom html content for a submit button in a form stopped working. The button from example below is rendered empty in v3.1.4 and is rendered as expected in v3.1.3 We sometimes set html inside a button to e.g. add an icon as a specially styled span element.

Steps To Reproduce

<?php
$form = new \Nette\Forms\Form('form');
$form->addText('dummyText', 'Type anything:');

$submit = $form->addSubmit('submit', NULL);
$button = $submit->getControlPrototype();
$button->setName("button");
$button->addHtml(Nette\Utils\Html::el('span')->setText('Submit me'));
echo $form;

if ($form->isSuccess()) {
	echo "<pre>Values: \n";
	print_r($form->getValues());
}

Expected Behavior

I would expect the "Submit me" text to appear inside a button element rendered like this: <button><span>Submit me</span></button>

The output from the code above in v3.1.3 is:

<form action="" method="post" id="frm-form">

<table>
<tr>
	<th><label for="frm-form-dummyText">Type anything:</label></th>

	<td><input type="text" name="dummyText" id="frm-form-dummyText" class="text"></td>
</tr>

<tr>
	<th></th>

	<td><button type="submit" name="_submit"><span>Submit me</span></button></td>
</tr>
</table>

<input type="hidden" name="_form_" value="form"><!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->
</form>

in v 3.1.4 is:

<form action="" method="post" id="frm-form">

<table>
<tr>
	<th><label for="frm-form-dummyText">Type anything:</label></th>

	<td><input type="text" name="dummyText" id="frm-form-dummyText" class="text"></td>
</tr>

<tr>
	<th></th>

	<td><button type="submit" name="_submit"></button></td>
</tr>
</table>

<input type="hidden" name="_form_" value="form"><!--[if IE]><input type=IEbug disabled style="display:none"><![endif]-->
</form>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions