Answers for "html form validation"

2

javascript login validation

<script language = "JavaScript">
        function validate() {
            var username = document.getElementById("username").value;
            var password = document.getElementById("password").value;
            if (username == null || username == "") {
                alert("Please enter the username.");
                return false;
            }
            if (password == null || password == "") {
                alert("Please enter the password.");
                return false;
            }
            alert('Login successful');
            
        } 
</script>
Posted by: Guest on March-19-2020
2

name validation html

<input type="text" pattern="[a-zA-Z'-'\s]*">
Posted by: Guest on September-18-2020
0

form valid

def form_valid(self, form):
	form.instance.user = self.request.user
    super(Your_View, self).form_valid(form)
    return redirect('home')
Posted by: Guest on September-30-2020

Browse Popular Code Answers by Language