textarea form field doesn't fill the default data

Notice: This thread is very old.
limuhob
Member | 16
+
0
-

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
+
0
-

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)

limuhob
Member | 16
+
0
-

Thanks. It isn't a big issue for me. However consistent behavior would be fine I think . Maybe I will file an issue on GitHub.

Have a nice day.