textarea form field doesn't fill the default data
- limuhob
- Member | 16
Hi guys,
I have a form with a textarea field. I add this textarea by this code:
$this->addTextArea('clientMessage')
->setRequired("mandatory")
->setValue("default text");
If I render this form in a latte template this way:
{input clientMessage}
the textarea is rendered correct:
<textarea name="clientMessage" id="frmmessageForm-clientMessage" required="required" data-nette-rules="{op:':filled',msg:'mandatory'}">default text</textarea>
However if I render the textarea this way:
<textarea n:input="clientMessage"></textarea>
the textarea is rendered withou default text:
<textarea name="clientMessage" id="frmmessageForm-clientMessage" required="required" data-nette-rules="{op:':filled',msg:'mandatory'}"></textarea>
Is this bug or Do I something wrong?
- redhead
- Member | 1313
I don't think it's a bug per se, it's just limitation of how Latte works. You have already written tag including value (between opening and closing tag), Latte just can't change this. I have no idea if this can be fixed.
For now I would stick with macro {input}
. If you need to
specify extra attributes (like cols
for example) you can still use
it like this:
{input clientMessage cols => 40}
But you can file an issue on GitHub and see what author has to say about it.
Last edited by redhead (2013-02-07 16:31)