Table of Contents
What is HTML Form?
- HTML Form एक Document का एक Section है जिसमें Text Field, Password Field, Checkbox, Radio Button, Submit Button, Menu इत्यादि जैसे Controls शामिल हैं।
- User Input Data को Collect करने के लिए HTML Form का Use किया जाता है। Processing के लिए User Input Data को अक्सर Server पर Send किया जाता है।
HTML Form Example
Example Form
Why Use HTML Form
- HTML Form Use Site Visitor से कुछ Data Collect करने के लिए किया जाता हैं।
- For Example: यदि कोई User Internet पर कुछ Items खरीदना चाहता है, तो उसे Shipping के लिए Address और Credit/Debit Card का Details जैसे Form भरने होंगे ताकि Items दिए गए Address पर Send किया जा सके।
Form Element
- HTML <form> Element User से Input लेने के लिए एक Document Section प्रदान करता है। यह Web Server को जानकारी Submit करने के लिए विभिन्न Interactive Controls प्रदान करता है जैसे Text Field, Text Area, Password Field इत्यादि।
Note: <form> Element स्वयं एक Form नहीं बनाता है, लेकिन यह Container है जिसमें सभी आवश्यक Form Element होते हैं, जैसे <input>, <label>, आदि।
Syntax :-
Form Attribute
Action Attribute
- <form> Element की Action Attribute Form Submit करते समय Form पर की जाने वाली प्रक्रिया को Define करते है, या यह Form की जानकारी को Process करने के लिए एक URI (Universal Resource Identifier) है।
- Action Attribute Value उस Web Page को Define करता है जहां जानकारी आगे बढ़ती है। यह .php, .jsp, .asp, आदि या कोई भी URL हो सकता है जहाँ आप अपने Form को Process करना चाहते हैं।
Target Attribute
- Target Attribute निर्दिष्ट (Specified) करती है कि Form Submit करने के बाद प्राप्त Resource को कहाँ Display किया जाए।
- Target Attribute में निम्न में से कोई एक Value हो सकता है:
- _self – Default। Document को उसी Window/Tab में खोलता है जिस पर Click किया गया था।
- _blank – Document को एक New Window या Tab में खोलता है।
- _parent – Document को Parent Frame में खोलता है।
- _top – Document को पूरी Window में खोलता है।
Method Attribute
- Method Attribute HTTP Method को Define करता है जिसका Use Browser Form को Submit करने के लिए किया जाता है। Method Attribute के Possible Value हो सकते हैं:
- get: Form Submit करते समय Method Attribute का Get Value होता है। यह Default Value होता है। लेकिन यह सुरक्षित नहीं है क्योंकि Form Submit करने के बाद यह URL में Data Display करता है।
- post: जब हम Sensitive Data को Process करना चाहते हैं तो हम Method Attribute के Post value को Use कर सकते हैं क्योंकि यह URL में Submit किए गए Data को Display नहीं करता है।
Autocomplete Attribute
- Autocomplete Attribute निर्दिष्ट (Specified) करती है कि किसी Form को Autocomplete “ on ” या “ off ” होना चाहिए।
- Autocomplete Attribute का Default Value “on” होता है।\
Novalidate Attribute
- Novalidate Attribute एक Boolean Attribute है।
- यदि हम Attribute को इस रूप में Apply करते हैं तो यह किसी प्रकार का सत्यापन नहीं करता है और Form Submit कर देता है।
Facebook
Pinterest
LinkedIn
WhatsApp