Files
komp_ac/web/templates/pages/add_validation/shared_fields.html
2026-08-14 20:35:37 +02:00

34 lines
2.9 KiB
HTML

{#
Validation inputs shared by the field-validation and reusable-rule pages.
Reads `page.form` (crate::pages::add_validation::state::ValidationForm).
#}
<label class="wide">{{ nav.tr("validation-position-rules") }}
<textarea name="pattern_rules" rows="6"
placeholder="0-3 | alphabetic&#10;4,5 | one-of=-,+&#10;6+ | regex=[0-9]">{{ page.form.pattern_rules }}</textarea>
<small>{{ nav.tr("validation-position-rules-hint") }}</small>
</label>
<label class="wide">{{ nav.tr("validation-pattern-description") }}<input name="pattern_description" value="{{ page.form.pattern_description }}"></label>
<label>{{ nav.tr("validation-min-length") }}<input name="minimum" type="number" min="0" value="{{ page.form.minimum }}"></label>
<label>{{ nav.tr("validation-max-length") }}<input name="maximum" type="number" min="0" value="{{ page.form.maximum }}"></label>
<label>{{ nav.tr("validation-warn-at") }}<input name="warn_at" type="number" min="0" value="{{ page.form.warn_at }}"></label>
<label>{{ nav.tr("validation-count-mode") }}
<select name="count_mode">
<option value="chars">{{ nav.tr("validation-count-chars") }}</option>
<option value="bytes" {% if page.form.count_mode == "bytes" %}selected{% endif %}>{{ nav.tr("validation-count-bytes") }}</option>
<option value="display-width" {% if page.form.count_mode == "display-width" %}selected{% endif %}>{{ nav.tr("validation-count-display-width") }}</option>
</select>
</label>
<label class="wide">{{ nav.tr("validation-allowed-values") }}<input name="allowed_values" value="{{ page.form.allowed_values }}" placeholder="draft, issued, paid"></label>
<label>{{ nav.tr("validation-display-mask") }}<input name="mask_pattern" value="{{ page.form.mask_pattern }}" placeholder="####-##-##"></label>
<label>{{ nav.tr("validation-mask-input-char") }}<input name="mask_input_char" value="{{ page.form.mask_input_char }}" placeholder="#"></label>
<label>{{ nav.tr("validation-mask-template-char") }}<input name="mask_template_char" value="{{ page.form.mask_template_char }}" placeholder="_"></label>
<div class="check-group">
<label class="check"><input type="checkbox" name="required" value="true" {% if page.form.required %}checked{% endif %}>{{ nav.tr("validation-required") }}</label>
<label class="check"><input type="checkbox" name="allow_empty" value="true" {% if page.form.allow_empty %}checked{% endif %}>{{ nav.tr("validation-allow-empty") }}</label>
<label class="check"><input type="checkbox" name="case_insensitive" value="true" {% if page.form.case_insensitive %}checked{% endif %}>{{ nav.tr("validation-case-insensitive") }}</label>
<label class="check"><input type="checkbox" name="external_validation_enabled" value="true" {% if page.form.external_validation_enabled %}checked{% endif %}>{{ nav.tr("validation-external") }}</label>
<label class="check"><input type="checkbox" name="locked" value="true" {% if page.form.locked %}checked{% endif %}>{{ nav.tr("validation-lock") }}</label>
</div>