I think on htmx it's through hx-validate="true"
i.e.
<form hx-post="/assessment-result.php" hx-validate="true">
<input type="text" required pattern="[a-zA-Z]+" />
<button type="submit">Submit</button>
</form>
you can check these repos the way they implement validation as well.