rut maximo caracteres

This commit is contained in:
2026-03-21 22:04:38 -03:00
parent 1780572095
commit c377363943

View File

@@ -22,12 +22,13 @@
<div class="mb-3"> <div class="mb-3">
<label class="form-label">RUT</label> <label class="form-label">RUT</label>
<input type="text" <input type="text"
class="form-control" class="form-control"
name="rut" name="rut"
id="rutInput" id="rutInput"
placeholder="12.345.678-9" placeholder="12.345.678-9"
required maxlength="12"
autofocus> required
autofocus>
</div> </div>
<div class="mb-4"> <div class="mb-4">
<label class="form-label">Contraseña</label> <label class="form-label">Contraseña</label>
@@ -45,6 +46,11 @@
<script> <script>
document.getElementById('rutInput').addEventListener('input', function(e) { document.getElementById('rutInput').addEventListener('input', function(e) {
let value = this.value.replace(/[^0-9kK]/g, '').toUpperCase(); let value = this.value.replace(/[^0-9kK]/g, '').toUpperCase();
if (value.length > 9) {
value = value.slice(0, 9);
}
if (value.length > 1) { if (value.length > 1) {
let body = value.slice(0, -1); let body = value.slice(0, -1);
let dv = value.slice(-1); let dv = value.slice(-1);