validar input html code example

Example 1: html form validation

<form action="">
    <label for="name">Username</label>
    <input id="name" type="text" required />
    <label for="Email">Email</label>
    <!-- The required attribute will prompt the user to make sure  -->
    <!-- the fields are not empty, and that the email is formatted correctly -->
    <!-- if you want to use custom validation you should use regex in JavaScript -->
    <input id="Email" type="text" required />
</form>

Example 2: html validator

# W3C - Check the markup (HTML, XHTML,) of Web documents:
https://validator.w3.org/
# CSS:
https://jigsaw.w3.org/css-validator/

Example 3: form valid

def form_valid(self, form):
	form.instance.user = self.request.user
    super(Your_View, self).form_valid(form)
    return redirect('home')