Thanks for the follow up Ken I just looked at my code and I see what I have done wrong
Below is my code. The issue I have is I forgot to add the field to my crispy layout.
Going to add now and see if it helps.
class HoneypotField(forms.BooleanField):
default_widget = forms.CheckboxInput(
{"style": "display:none !important;", "tabindex": "-1", "autocomplete": "off"}
)
def __init__(self, *args, **kwargs):
kwargs.setdefault("widget", HoneypotField.default_widget)
kwargs["required"] = False
super().__init__(*args, **kwargs)
def clean(self, value):
if cleaned_value := super().clean(value):
raise ValidationError("")
else:
return cleaned_value
class ContactForm(forms.Form):
asdf = HoneypotField()
name = forms.CharField(
max_length=100,
required=True,
widget=FloatingLabelWidget(
attrs={
"class": "text-light placeholder-transparent peer h-10 w-full border-b-2 border-light text-orange-300 focus:outline-none\
focus:border-gold bg-transparent"
}
),
)
email = forms.CharField(
max_length=100,
required=True,
widget=FloatingLabelWidget(
attrs={
"class": "text-light placeholder-transparent peer h-10 w-full border-b-2 border-light text-orange-300 focus:outline-none\
focus:border-gold bg-transparent"
}
),
)
message = forms.CharField(
help_text="",
widget=FloatingLabelTextAreaWidget(
attrs={
"class": "text-light placeholder-transparent peer w-full border-b-2 border-light text-orange-300 focus:outline-none\
focus:border-gold bg-transparent mt-5"
}
),
)
opt_in = forms.BooleanField(
label=False,
required=True,
)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.helper = FormHelper()
self.helper.label_class = "absolute transition-all left-0 -top-3.5 text-gold text-sm peer-placeholder-shown:text-base \
peer-placeholder-shown:text-gold peer-placeholder-shown:top-2 peer-focus:-top-3.5 peer-focus:text-gold \
peer-focus:text-sm"
self.helper.form_class = "ml-5p w-full md:w-2/3 lg:w-1/2 my-10"
self.helper.layout = Layout(
Field(
"name",
template="tailwind/floating_label_field.html",
wrapper_class="relative my-5",
placeholder="Name",
),
Field(
"email",
template="tailwind/floating_label_field.html",
wrapper_class="relative my-5",
placeholder="Email",
),
Field(
"message",
template="tailwind/floating_label_field.html",
wrapper_class="relative my-5",
placeholder="Message",
),
Div(
HTML(
"""
<div class="font-noe text-sm font-normal tracking-tight text-skin mb-3 mt-1">I confirm that I have read and agree to Emma Wedgwood Aesthetics <a href="/privacy-terms" class="underline" >terms and privacy policy.</a></div>
"""
),
Field(
"opt_in",
),
css_class="grid grid-cols-2",
),
## NEED TO ADD MY FIELD HERE ##
ButtonHolder(
Submit(
"submit",
"Submit",
css_class="bg-transparent cursor-pointer font-semibold h-8 font-rubik text-ourstory border border-gold hover:border-gold text-xs rounded-3xl w-1/5",
)
),
)