Files
komp_ac/web/templates/pages/add_validation/shared_fields.html
2026-08-03 13:32:25 +02:00

35 lines
2.6 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">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>One per line: position | constraint. Positions: 0, 0-3, 4+, or 1,3,5.
Constraints: alphabetic, numeric, alphanumeric, exact=x, one-of=a,b, regex=…</small>
</label>
<label class="wide">Pattern description<input name="pattern_description" value="{{ page.form.pattern_description }}"></label>
<label>Minimum length<input name="minimum" type="number" min="0" value="{{ page.form.minimum }}"></label>
<label>Maximum length<input name="maximum" type="number" min="0" value="{{ page.form.maximum }}"></label>
<label>Warning threshold<input name="warn_at" type="number" min="0" value="{{ page.form.warn_at }}"></label>
<label>Count mode
<select name="count_mode">
<option value="chars">Characters</option>
<option value="bytes" {% if page.form.count_mode == "bytes" %}selected{% endif %}>Bytes</option>
<option value="display-width" {% if page.form.count_mode == "display-width" %}selected{% endif %}>Display width</option>
</select>
</label>
<label class="wide">Allowed values<input name="allowed_values" value="{{ page.form.allowed_values }}" placeholder="draft, issued, paid"></label>
<label>Display mask<input name="mask_pattern" value="{{ page.form.mask_pattern }}" placeholder="####-##-##"></label>
<label>Mask input character<input name="mask_input_char" value="{{ page.form.mask_input_char }}" placeholder="#"></label>
<label>Mask template character<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 %}>Required</label>
<label class="check"><input type="checkbox" name="allow_empty" value="true" {% if page.form.allow_empty %}checked{% endif %}>Allow empty</label>
<label class="check"><input type="checkbox" name="case_insensitive" value="true" {% if page.form.case_insensitive %}checked{% endif %}>Case insensitive</label>
<label class="check"><input type="checkbox" name="external_validation_enabled" value="true" {% if page.form.external_validation_enabled %}checked{% endif %}>External validation</label>
<label class="check"><input type="checkbox" name="locked" value="true" {% if page.form.locked %}checked{% endif %}>Lock configuration</label>
</div>