Input form Attributes in HTML

Is chapter me Input form Attributes in HTML ke baare me detail me discuss kiya jayega. Input form Attributes in HTML form elements ko control karne aur unhe specific form ke saath connect karne ke liye use kiye jaate hain.


The form Attribute

form attribute batata hai ki <input> element kis <form> ka part hai. Is attribute ki value us <form> ke id ke barabar honi chahiye jiske saath input ko connect karna hai.

Input form ke bahar bhi ho sakta hai, lekin form attribute ki madad se us form ka part ban sakta hai.

Example:

form Attribute


The formaction Attribute

formaction attribute batata hai ki form submit hone par data kis URL par process hoga. Yeh <form> ke action attribute ko override karta hai. Yeh attribute sirf submit aur image type ke input ke saath kaam karta hai.

Example:

The formaction Attribute


The formenctype Attribute

formenctype attribute specify karta hai ki form-data kis format me encode hoga jab submit kiya jaayega. Yeh sirf tab kaam karta hai jab method=”post” ho. Yeh <form> ke enctype attribute ko override karta hai. 

Yeh attribute submit aur image input types ke saath kaam karta hai.

Example:

The formenctype Attribute


The formmethod Attribute

formmethod attribute define karta hai ki form-data kis HTTP method se bheja jaayega. Yeh <form> ke method attribute ko override karta hai. Yeh attribute submit aur image type ke inputs ke saath kaam karta hai.

Form-data do tareeke se bheja ja sakta hai:

  • get
  • post 

GET Method:

  • Data URL me name/value pairs ke form me attach hota hai.
  • Result bookmark kiya ja sakta hai.
  • URL me data visible hota hai.
  • Data size limit hoti hai.
  • Sensitive information ke liye use nahi karna chahiye.

POST Method:

  • Data HTTP request body me bheja jaata hai.
  • Bookmark nahi kiya ja sakta.
  • Zyada secure aur robust hota hai.
  • Size limitation nahi hoti.

Example:

The formmethod Attribute


The formtarget Attribute

formtarget attribute batata hai ki form submit hone ke baad jo response milega, woh kahan display hoga. Yeh <form> ke target attribute ko override karta hai.

Yeh attribute submit aur image input types ke saath kaam karta hai.

Common values:

  • _self (same page)
  • _blank (new tab/window)

Example:

The formtarget Attribute


The formnovalidate Attribute

formnovalidate attribute specify karta hai ki jab particular submit button se form submit hoga, to validation nahi hoga. Yeh <form> ke novalidate attribute ko override karta hai.

Yeh sirf submit type ke input ke saath kaam karta hai.

Example:

The formnovalidate Attribute


The novalidate Attribute

novalidate ek <form> attribute hai. Jab yeh present hota hai, to form submit karte waqt koi validation perform nahi hoti. Saari input fields bina check kiye submit ho jaati hain. Yeh bhi Input form Attributes in HTML ka ek useful feature hai jab developer validation manually control karna chahta hai.

Example:

The novalidate Attribute

Leave a Comment