nette/docs

[disabled] != [readonly]

Closed this issue · 1 comments

If we need a read-only input (the input will be rendered as disabled but its value will be shown), we disable the input first and set the value afterwards. […]

$form->addText('readonly', 'Readonly:')->setDisabled()->setValue('readonly value');

https://github.com/nette/docs/blob/doc-2.4/en/forms.texy#L235

Please differentiate between [disabled] and [readonly]!

[…] disabled inputs are not submitted with the form.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#disabled

Greetings!

Try this: $form->addText('readonly', 'Readonly:')->setHtmlAttribute('readonly');