Loading Please Wait...
HTML input elements have some attributes which is used to refer the form it belongs to and modify form properties. These input form attributes overrides the default value of the form element itself.
The form attribute defines the form an input element belongs to. The value of the form attribute is same as the id of the form element. This is helpful when we have input element outside the form and want to submit its value along with the form.
<form id="myForm">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit">
</form>
<label for="phone">Phone:</label>
<input type="tel" name="phone" id="phone" form="myForm">
The formaction attribute defines the action of the form when form is submitted. It overrides the action attribute of the form element. This will work only with submit and image input types that trigger the form submission.
<form action="server1.php">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit" formaction="server2.php">
</form>
The formenctype attribute defines the encoding of the data when form is submitted.
<form action="server.php">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit" formenctype="multipart/form-data">
</form>
The formmethod attribute defines the get or post method of the form.
<form action="server.php">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit">
<input type="submit" formmethod="post">
</form>
The formtarget attribute defines location of the response display after form is submitted.
<form action="server.php">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit">
<input type="submit" formtarget="_top">
</form>
The formnovalidate attribute defines that the input element should not be validated when form is submitted.
<form action="server.php">
<label for="name">Name:</label>
<input type="text" name="name" id="name">
<label for="email">Email:</label>
<input type="email" name="email" id="email">
<input type="submit">
<input type="submit" formnovalidate="formnovalidate">
</form>
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved