HUGO

Can't use texarea instead of input

This seems really strange to me, but I get an error when I use textarea in place of input in a partial:

...
<div class="control-group">
  <div class="form-group col-xs-12 floating-label-form-group controls">
    <textarea class="form-control" rows="3" placeholder="Message" id="message" name="message">
  </div>
</div>
...

Here’s the error message (added linebreaks for readability):

.../themes/mytheme/layouts/_default/single.html:46:5": 
execute of template failed: 
template: _default/single.html:46:5: 
executing "_default/single.html" at <partial "leadcap.html" .>: 
error calling partial: 
execute of template failed: 
html/template:partials/leadcap.html: 
ends in a non-text context: 
{stateRCDATA delimNone urlPartNone jsCtxRegexp attrNone elementTextarea <nil>}

I think you are missing this… where was it? Damn, I just had it…

t

Ah, there it is! :sunglasses:

It goes in “texarea”!

I’m not that dumb. That was a typo (corrected) in my original post here, not in my code. I still have the error.

It’s kinda funny actually — If I do use a misspelled element name like texarea it DOES work.

You are missing the whole closing </textarea> tag.

1 Like

I can’t believe it!!! That was it. I never considered this was not a self-closing tag like <input>.

The error message could be a little more descriptive, but that’s probably more of a Go thing than a Hugo thing.

Thanks!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.