gorgeous-photographer-36571
02/17/2023, 1:55 PMgorgeous-photographer-36571
02/17/2023, 1:58 PMset $modal to mdb.Modal.getInstance(#modal)
(I use Material Design Bootstrap and it's components), but I keep getting an error Error: variables declared at the feature level must be element scoped.
gorgeous-photographer-36571
02/17/2023, 2:01 PMmysterious-toddler-20573
02/17/2023, 2:25 PMgorgeous-photographer-36571
02/17/2023, 2:25 PMgorgeous-photographer-36571
02/17/2023, 2:25 PMmysterious-toddler-20573
02/17/2023, 2:26 PMgorgeous-photographer-36571
02/17/2023, 2:26 PMgorgeous-photographer-36571
02/17/2023, 2:26 PMmysterious-toddler-20573
02/17/2023, 2:26 PMmysterious-toddler-20573
02/17/2023, 2:26 PMmysterious-toddler-20573
02/17/2023, 2:26 PMgorgeous-photographer-36571
02/17/2023, 2:27 PMmysterious-toddler-20573
02/17/2023, 2:27 PMgorgeous-photographer-36571
02/17/2023, 2:31 PMgorgeous-photographer-36571
02/17/2023, 2:31 PMgorgeous-photographer-36571
02/17/2023, 2:31 PM<div
id="modal"
class="modal fade"
aria-hidden="true"
aria-labelledby="modal"
tabindex="-1"
_="init set $modalInstance to mdb.Modal.getOrCreateInstance(me) end"
>
gorgeous-photographer-36571
02/17/2023, 2:31 PMlittle-plumber-64748
02/17/2023, 7:19 PMworried-portugal-65416
02/18/2023, 3:49 PMworried-portugal-65416
02/18/2023, 3:50 PMworried-portugal-65416
02/18/2023, 3:53 PMmammoth-family-48524
02/18/2023, 11:29 PMtall-chef-86788
02/20/2023, 11:30 AMdjango-crispy-forms
html
<form method="POST" action='/user/signup'>
<input id='username' type='text' name='username' />
<input id='password' type='text' name='discriminator' />
</form>
This is my python code
python
# forms.py
class UserNameWithDiscriminatorForm(forms.Form):
username = forms.TextField()
discriminator = forms.IntegerField()
python
# views.py
def check_if_username_with_discriminator_exists(request:HttpRequest)->HttpResponse:
form = UserNameWithDiscriminatorForm(request.POST or None)
if form.is_valid():
...
# Checks to see if current username with discriminator is available
if username_is_available:
return HttpResponse(200)
else:
return HttpResponse(400)
Now i submit a form using jQuery
to check if username with discriminator is available and then add a red
class to input element. Is it possible to recreate this effect using htmx
?
( I am comfortable with JS | Just want to know if HTMX can achieve what i am looking for )
Thanks :Dcareful-holiday-81711
02/20/2023, 4:54 PMcareful-holiday-81711
02/20/2023, 4:55 PMtall-dinner-62086
02/20/2023, 5:32 PMhx-boost
will get you 80% of the way there. The rest is gonna be up to you depending on how complex you want to make your interactionscareful-holiday-81711
02/20/2023, 5:52 PMbitter-monkey-50309
02/20/2023, 6:52 PMclean
method and have it attach an error using form.add_error()
, that way Django will automatically format the error inline and all you've got to do is get htmx to replace it.