<form action="/forms/domains/{{Layout.domain}}./records/" method="POST" data-element="popup" data-id="edit_dns_record"{{#if this.position}} data-position="{{this.position}}"{{/if}}>
    <div class="field" data-id="type">
        <label>{{i18n "dns.prop.type"}}*</label>
        {{#if this.record}}
        <input type="text" value="{{this.record.type}}" class="full-width" disabled>
        <input type="hidden" name="id<number>" value="{{this.record.id}}">
        <input type="hidden" name="type" value="{{this.record.type}}">
        {{else}}
        <select name="type" class="full-width" required>
            <option></option>
            {{#each Layout.RECORD_TYPES}}
            <option value="{{this}}"{{#is ../this.record.type this}} selected{{/is}}>{{this}}</option>
            {{/each}}
        </select>
        {{/if}}
    </div>
    <div class="field" data-id="name">
        <label>{{i18n "dns.prop.host"}}*</label>
        <input type="text" name="name" value="{{this.record.name}}" class="full-width" required>
    </div>
    <div class="field" data-id="address" data-types="A AAAA">
        <label><em>address</em>*</label>
        <input type="text" name="rdata[address]" value="{{this.record.rdata.address}}" class="full-width" required>
    </div>
    <div class="field" data-id="priority" data-types="SRV">
        <label><em>priority</em>*</label>
        <input type="text" name="rdata[priority<number>]" value="{{this.record.rdata.priority}}" class="full-width" required>
    </div>
    <div class="field" data-id="weight" data-types="SRV">
        <label><em>weight</em>*</label>
        <input type="text" name="rdata[weight<number>]" value="{{this.record.rdata.weight}}" class="full-width" required>
    </div>
    <div class="field" data-id="port" data-types="SRV">
        <label><em>port</em>*</label>
        <input type="text" name="rdata[port<number>]" value="{{this.record.rdata.port}}" class="full-width" required>
    </div>
    <div class="field" data-id="target" data-types="CNAME NS SRV">
        <label><em>target</em>*</label>
        <input type="text" name="rdata[target]" value="{{this.record.rdata.target}}" class="full-width" required>
    </div>
    <div class="field" data-id="preference" data-types="MX">
        <label><em>preference</em>*</label>
        <input type="text" name="rdata[preference<number>]" value="{{this.record.rdata.preference}}" class="full-width" required>
    </div>
    <div class="field" data-id="exchange" data-types="MX">
        <label><em>exchange</em>*</label>
        <input type="text" name="rdata[exchange]" value="{{this.record.rdata.exchange}}" class="full-width" required>
    </div>
    <div class="field" data-id="strings" data-types="TXT">
        <label>{{i18n "dns.prop.content"}}*</label>
        <input type="text" value="{{this.record._content}}" class="full-width" required>
        <input type="hidden" name="rdata[strings<json>]" value="{{#if this.record.rdata.strings}}{{stringify this.record.rdata.strings}}{{else}}[]{{/if}}" class="full-width">
    </div>
    <div class="field" data-id="flag" data-types="CAA">
        <label><em>flag</em>*</label>
        <input type="text" name="rdata[flag<number>]" value="{{this.record.rdata.flag}}" class="full-width" required>
    </div>
    <div class="field" data-id="tag" data-types="CAA">
        <label><em>tag</em>*</label>
        <input type="text" name="rdata[tag]" value="{{this.record.rdata.tag}}" class="full-width" required>
    </div>
    <div class="field" data-id="value" data-types="CAA">
        <label><em>value</em>*</label>
        <input type="text" name="rdata[value]" value="{{this.record.rdata.value}}" class="full-width" required>
    </div>
    <div class="field" data-id="ttl">
        <label>{{i18n "dns.prop.ttl"}}*</label>
        <input type="text" name="ttl<number>" value="{{this.record.ttl}}" class="full-width" required>
    </div>
    <div class="actions">
        <button type="submit" class="highlighted" data-action="ok">{{i18n "dns.form.submit_record"}}</button>
        <label for="{{#if this.record.id}}edit_record_{{this.record.id}}{{else}}add_record{{/if}}_canceled" class="button" data-action="cancel">{{i18n "common.action.cancel"}}</label>
    </div>
    <input type="hidden" name="_api" value="dns">
    <input type="hidden" name="_headers[x-org-id<number>]" value="{{Layout.org_id}}">
</form>
