Struggling with trans in a input placeholder

Here is the HTML part

<div class="col-md-4 col-sm-4">
      <input type="text" class="form-control" placeholder={% trans "First Name" %} id="cf-fn" name="cf-fn" required="">
</div>

Instead of getting 'First Name', I got just 'First'. Here is a photo:

enter image description here

How could I fix it?

1 answer

  • answered 2018-01-11 21:13 jeprubio

    I've never used django yet but I think it's an HTML problem.

    Try setting the placeholder value between double quotes:

    <div class="col-md-4 col-sm-4">
          <input type="text" class="form-control" placeholder="{% trans "First Name" %}" id="cf-fn" name="cf-fn" required="">
    </div>
    

    Without the double quotes the browser is getting just the first word as the placeholder value and the second word is used as another attribute (Name) with no value.