Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Today something caught my eye. For some reason I cannot preload a form field of type 'text' with a value. I am not sure if this is intentional, an omission or a bug?

With a form field of type 'textarea' it works. I can preload a value into the form in this way:
Code: Select all
<cms:input
   type="textarea"
   name="example"
   cols="80"
   rows="5" >
Default field value
</cms:input>

or even in this way:
Code: Select all
<cms:input
   type="textarea"
   name="example"
   cols="80"
   rows="5" >
<cms:show some_value />
</cms:input>

Which is powerful and works great!

But if I try this exact same thing with type 'text' then the form field remains empty.
For now I simply use the textarea instead of text and it works. But I am curious... am I doing something wrong?
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
Please try using the following syntax -
Code: Select all
<cms:input type="text" name="example" value="hello" />

Hope this helps.
Hi KK, thanks, and of course I use that syntax where I can. But with that syntax, I did not succeed to include preloaded values with <cms:show field />. I do not want to show a fixed value, but the value stored in a variable. With my syntax, that at least works for textareas. I found that solution somewhere on this forum.
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
But with that syntax, I did not succeed to include preloaded values with <cms:show field />. I do not want to show a fixed value, but the value stored in a variable.
There is no reason why variables wouldn't work with the mentioned syntax.
Following are two working examples you may try -
Code: Select all
<cms:set my_greeting = 'hello world!' />

<cms:input type="text" name="example2" value=my_greeting /><br>
<cms:input type="text" name="example3" value="<cms:show my_greeting />" /><br>
Now I see where my confusion came from. For type 'text', preloading like you're describing works. It does not work for 'textarea'. For the latter you need to place the preloaded text within the cms;input tag.

So here's a recap for those seeking this info after me. This will work for type=text:
Code: Select all
<cms:input type="text" name="example" value="<cms:show my_greeting />" />

And this will work for type=textarea:
Code: Select all
<cms:input type="textarea" name="example" >
    <cms:show my_greeting />
</cms:input>
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
I believe Couch follows HTML standard here.
Code: Select all
<input type="text" name="lname" value="Dow"><br>
<textarea rows="4" cols="50">
Charles Dow
</textarea>


It is advisable to get HTML template working and then Couchify it thus avoid unnecessary confusion.
Then it's only more clear and better so! Thanks
"I have never tried that before, so I think I should definitely be able to do that" - Pippi Longstocking
7 posts Page 1 of 1