bff-challenge/templates/create.html.tera
2023-01-25 19:16:31 +01:00

44 lines
1.6 KiB
Plaintext

{% extends "base" %}
{% block title %}{% endblock %}
{% block body %}
<div class="hero h-fit">
<div class="hero-content flex-col text-center mt-48">
<h1 class="text-5xl font-bold">Crea tu propio test</h1>
<form class="card flex-shrink-0 w-full max-w-sm shadow-2xl bg-base-200 mt-6" id="signup-form"
action="/auth/register" method="post">
<div class="card-body">
<div class="form-control">
<label class="label">
<span class="label-text">Nombre</span>
</label>
<input type="text" name="username" id="username" placeholder="Entra tu nombre..." class="input input-bordered" />
</div>
<div class="form-control mt-6">
<input type="submit" class="btn btn-primary btn-disabled" id="continue-btn" value="Empezar"
disabled>
</div>
</div>
</form>
</div>
</div>
<script>
function debounce(callback, wait) {
let timeout;
return (...args) => {
clearTimeout(timeout);
timeout = setTimeout(function () { callback.apply(this, args); }, wait);
};
}
document.querySelector("#username").onkeyup = debounce(() => {
if(document.querySelector("#username").value.length != 0)
{
document.querySelector("#continue-btn").classList.remove("btn-disabled");
document.querySelector("#continue-btn").removeAttribute("disabled");
} else {
document.querySelector("#continue-btn").classList.add("btn-disabled");
document.querySelector("#continue-btn").disabled = true;
}
}, 100);
</script>
{% endblock %}