feat: prefer errors over button disables
This commit is contained in:
parent
66a45a2e16
commit
4a9733c432
2 changed files with 7 additions and 8 deletions
|
|
@ -93,13 +93,13 @@ mod get {
|
|||
body hx-ext="response-targets" {
|
||||
h1 { "Entretien" }
|
||||
main {
|
||||
form hx-post=(post_url) hx-target-error="#error" x-data=(json!({"user": state.autologin_user, "pass": state.autologin_pass, "htmx": false})) "x-on:htmx:load.document"="htmx = true" hx-trigger=(if state.autologin_pass.is_empty() { "submit" } else { "load" }) {
|
||||
form hx-post=(post_url) hx-target-error="#error" x-data=(json!({"htmx": false})) "x-on:htmx:load.document"="htmx = true" hx-trigger=(if state.autologin_pass.is_empty() { "submit" } else { "load" }) {
|
||||
label for="username" { "username" }
|
||||
input name="username" #username autofocus x-model="user" x-cloak;
|
||||
input name="username" #username autofocus value=(state.autologin_user);
|
||||
label for="password" { "password" }
|
||||
input name="password" #password type="password" x-model="pass" x-cloak;
|
||||
input name="password" #password type="password" value=(state.autologin_pass);
|
||||
|
||||
input type="submit" value="login" x-bind:disabled="!(user.length && pass.length && htmx)" hx-disabled-elt;
|
||||
button type="submit" value="login" x-bind:disabled="!htmx" hx-disabled-elt;
|
||||
#error {}
|
||||
}
|
||||
#blurb {
|
||||
|
|
|
|||
|
|
@ -79,15 +79,14 @@ mod get {
|
|||
hx-target="#completions"
|
||||
hx-target-error="find .errors"
|
||||
hx-on::after-request="console.log(event)"
|
||||
hx-swap="afterbegin"
|
||||
x-data=(json!({ "when": "" }))
|
||||
hx-swap="afterbegin"
|
||||
{
|
||||
.col {
|
||||
label for="when" { "when" }
|
||||
input id="when" name="datestamp" type="date" x-bind="when";
|
||||
input id="when" name="datestamp" type="date";
|
||||
.errors {}
|
||||
}
|
||||
button x-bind:disabled="when.length == 0" { "add completion" }
|
||||
button { "add completion" }
|
||||
}
|
||||
#completions {
|
||||
@if completions.is_empty() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue