<div class="form-field <%=type%>-<%= name %>">
    <% if ( type !== 'checkbox' ) { %>
        <label for="<%= form %>-<%= name %>">
            <%= label %>
            <% if ( required && requiredStr ) { %> <%= requiredStr %></label><% } %>
        </label>
    <% } %>

    <% if ( type === 'select' ) { %>
        <select id="<%= form %>-<%= name %>"
            name="<%= name %>"
            class="input-inline"
            aria-describedby="<%= form %>-<%= name %>-desc"
            <% if ( typeof errorMessages !== 'undefined' ) {
                _.each(errorMessages, function( msg, type ) {%>
                    data-errormsg-<%= type %>="<%= msg %>"
            <%  });
            } %>
            <% if ( required ) { %> aria-required="true" required<% } %>>
        <% _.each(options, function(el) { %>
            <option value="<%= el.value%>"<% if ( el.default ) { %> data-isdefault="true"<% } %>><%= el.name %></option>
        <% }); %>
        </select>
        <% if ( instructions ) { %> <span class="tip tip-input" id="<%= form %>-<%= name %>-desc"><%= instructions %></span><% } %>
    <% } else if ( type === 'textarea' ) { %>
        <textarea id="<%= form %>-<%= name %>"
            type="<%= type %>"
            name="<%= name %>"
            class="input-block"
            aria-describedby="<%= form %>-<%= name %>-desc"
            <% if ( restrictions.min_length ) { %> minlength="<%= restrictions.min_length %>"<% } %>
            <% if ( restrictions.max_length ) { %> maxlength="<%= restrictions.max_length %>"<% } %>
            <% if ( typeof errorMessages !== 'undefined' ) {
                _.each(errorMessages, function( msg, type ) {%>
                    data-errormsg-<%= type %>="<%= msg %>"
            <%  });
            } %>
            <% if ( required ) { %> aria-required="true" required<% } %> ></textarea>
            <% if ( instructions ) { %> <span class="tip tip-input" id="<%= form %>-<%= name %>-desc"><%= instructions %></span><% } %>
    <% } else { %>
        <input id="<%= form %>-<%= name %>"
           type="<%= type %>"
           name="<%= name %>"
           class="input-block <% if ( type === 'checkbox' ) { %>checkbox<% } %>"
            <% if ( type !== 'password' ) { %> aria-describedby="<%= form %>-<%= name %>-desc" <% } %>
            <% if ( restrictions.min_length ) { %> minlength="<%= restrictions.min_length %>"<% } %>
            <% if ( restrictions.max_length ) { %> maxlength="<%= restrictions.max_length %>"<% } %>
            <% if ( required ) { %> aria-required="true" required<% } %>
            <% if ( typeof errorMessages !== 'undefined' ) {
                _.each(errorMessages, function( msg, type ) {%>
                    data-errormsg-<%= type %>="<%= msg %>"
            <%  });
            } %>
            <% if ( placeholder ) { %> placeholder="<%= placeholder %>"<% } %>
            value="<%- defaultValue %>"
        />
        <% if ( type === 'checkbox' ) { %>
            <label for="<%= form %>-<%= name %>">
                <%= label %>
                <% if ( required && requiredStr ) { %> <%= requiredStr %><% } %>
            </label>
        <% } %>
        <% if ( instructions ) { %> <span class="tip tip-input" id="<%= form %>-<%= name %>-desc"><%= instructions %></span><% } %>
    <% } %>

    <% if( form === 'login' && name === 'password' ) { %>
        <a href="#" class="forgot-password field-link"><%- gettext("Forgot password?") %></a>
    <% } %>
</div>
