textarea form field doesn't fill the default data

1. about a year ago

limuhob
Member
Registered: 2013-02-07
Posts: 16

textarea form field doesn't fill the default data

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?

 

2. about a year ago

redhead
Member
Registered: 2009-05-02
Posts: 1318

Re: textarea form field doesn't fill the default data

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)

 

3. about a year ago

limuhob
Member
Registered: 2013-02-07
Posts: 16

Re: textarea form field doesn't fill the default data

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.

 

Board footer

Switch to desktop