HTML <form> autocomplete Attribute

Example A form with autocomplete on: <form action=”/action_page.php” method=”get” autocomplete=”on”> First name:<input type=”text” name=”fname”><br> E-mail: <input type=”email” name=”email”><br> <input type=”submit”> </form> Try it Yourself » Definition and Usage The autocomplete attribute specifies whether a form should have autocomplete on or off. When autocomplete is on, the browser automatically complete values based on values that the user has entered before. Tip: It is possible to have […]

HTML <form> name Attribute

Example An HTML form with a name attribute: <form action=”/action_page.php” method=”get” name=”myForm”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”button” onclick=”formSubmit()” value=”Send form data!”> </form> Try it Yourself » Definition and Usage The name attribute specifies the name of a form. The name attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted. Browser […]

HTML <form> accept-charset Attribute

Example A form with an accept-charset attribute: <form action=”/action_page.php” accept-charset=”ISO-8859-1″> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The accept-charset attribute specifies the character encodings that are to be used for the form submission. The default value is the reserved string “UNKNOWN” (indicates that the encoding equals the encoding of the document […]

HTML <form> accept Attribute

Example Specify that the server accepts only gif and jpeg files in the file upload: <form action=”/action_page.php” accept=”image/gif,image/jpeg”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> Your image: <input type=”file” name=”pic” id=”pic”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The <form> accept attribute is not supported in HTML5. The accept attribute specifies the types of files that the server accepts (that can be […]

HTML <form> method Attribute

Example Submit a form using the “get” method: <form action=”/action_page.php” method=”get”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The method attribute specifies how to send form-data (the form-data is sent to the page specified in the action attribute). The form-data can be sent as URL […]

HTML <form> novalidate Attribute

Example Indicate that the form is not to be validated on submit: <form action=”/action_page.php” novalidate> E-mail: <input type=”email” name=”user_email”> <input type=”submit”> </form> Try it Yourself » Definition and Usage The novalidate attribute is a boolean attribute. When present, it specifies that the form-data (input) should not be validated when submitted. Browser Support The numbers in the table specify the first browser […]

HTML <form> target Attribute

Example Display the response received in a new window or tab: <form action=”/action_page.php” method=”get” target=”_blank”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form. The target attribute defines a name of, […]

HTML <form> enctype Attribute

Example Send form-data encoded as “multipart/form-data”: <form action=”/action_page_binary.asp” method=”post” enctype=”multipart/form-data”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The enctype attribute specifies how the form-data should be encoded when submitting it to the server. Note: The enctype attribute can be used only if method=”post”. Browser Support Attribute enctype Yes Yes Yes Yes Yes Differences […]

HTML <form> action Attribute

Example On submit, send the form-data to a file named “/action_page.php” (to process the input): <form action=”/action_page.php” method=”get”> First name: <input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The action attribute specifies where to send the form-data when a form is submitted. Browser Support Attribute action Yes Yes Yes Yes Yes Differences Between HTML […]