Autoform field with multiple templates


#1

I used to need a custom template for my input field and want the formgroup to use the bootstrap3-horizonal template.

I tried different things, my latest approach was this:

Field in Schema:

"city.unique_name": {
    type: String,
    label: "City",
    optional: true,
    autoform: {
        afFieldInput: {
            template: "cities"
        }
    }
},

Form element:

+afQuickField(name='profile.city.unique_name' template="bootstrap3-horizontal" label-class="col-sm-3" input-col-class="col-sm-9")

Someone an idea about that?


#2

Isn’t horizontal set on <form>?

<form class="form-horizontal">


#3

The structure of the form groups is different in horizontal forms:

<form class="form-horizontal">
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">Email</label>
    <div class="col-sm-10">
      <input type="email" class="form-control" id="inputEmail3" placeholder="Email">
    </div>
  </div>
</form>

Normal form:

<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
  </div>
</form>