Home > Web Front-end > HTML Tutorial > In HTML, how to specify that a form does not validate when in the disabled state?

In HTML, how to specify that a form does not validate when in the disabled state?

WBOY
Release: 2023-08-29 23:05:09
forward
1399 people have browsed it

In HTML, how to specify that a form does not validate when in the disabled state?

In HTML, forms for user input are created using the

tag. Form tags use many different elements. When a form is submitted, the
novalidate attribute of the HTML tag is used to indicate that the form data should not be validated. This property is a boolean value.

The following are examples...

Example

In the example below, we use novalidate to make the form disabled after submission.

<!DOCTYPE html>
<html>
<body style="text-align:center;">
   <form action="#" method="get"
      target="_self" novalidate>
      Name:
      <input type="text">
      <input type="submit" id="tutorials"
      name="mytutorials"
      value="Submit@tutorialspoint"
      formTarget="_blank">
   </form>
</body>
</html>
Copy after login

Output

When the above script is executed, the window will open and display the input fields as well as the submit button. When the submit button is clicked, it opens in a new tab and no changes will occur since the form is not validated.

Example

Another example to explain the novalidate attribute is as follows -

<!DOCTYPE html>
<html>
<head>
   <title>HTML novalidate attribute</title>
</head>
<body>
   <form action = "" method = "get" novalidate>
      Student Name<br><input type = "name" name = "sname"><br>
      Rank<br><input type = "number" name = "rank"><br>
      <input type = "submit" value = "Submit">
   </form>
</body>
</html>
Copy after login

Output

When the above script is executed, a window will open and display the input fields students name and rank and a submit button. When the submit button is clicked, since the form is not validated, it opens a new tab without any changes.

The above is the detailed content of In HTML, how to specify that a form does not validate when in the disabled state?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template