<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>autocomplete Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/autocomplete/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/autocomplete/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 21 Feb 2026 07:13:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Complete Guide to Autocomplete: Use Cases, Architecture, Workflow, and Getting Started</title>
		<link>https://www.scmgalaxy.com/tutorials/complete-guide-to-autocomplete-use-cases-architecture-workflow-and-getting-started/</link>
					<comments>https://www.scmgalaxy.com/tutorials/complete-guide-to-autocomplete-use-cases-architecture-workflow-and-getting-started/#respond</comments>
		
		<dc:creator><![CDATA[Vijay K]]></dc:creator>
		<pubDate>Sat, 28 Jun 2025 11:42:00 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[DataEntry]]></category>
		<category><![CDATA[FrontendDevelopment]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SearchFunctionality]]></category>
		<category><![CDATA[TechEducation]]></category>
		<category><![CDATA[UIComponents]]></category>
		<category><![CDATA[UserExperience]]></category>
		<category><![CDATA[WebDevelopment]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=13009</guid>

					<description><![CDATA[<p>What is Autocomplete? Autocomplete is a user interface (UI) component that assists users by predicting and suggesting possible completions for [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/complete-guide-to-autocomplete-use-cases-architecture-workflow-and-getting-started/">Complete Guide to Autocomplete: Use Cases, Architecture, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="683" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1024x683.png" alt="" class="wp-image-13012" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1024x683.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-300x200.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-768x512.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image.png 1536w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What is Autocomplete?</strong></h3>



<p class="wp-block-paragraph"><strong>Autocomplete</strong> is a user interface (UI) component that assists users by predicting and suggesting possible completions for a partially entered text. This functionality is often utilized in <strong>search bars</strong>, <strong>forms</strong>, and <strong>input fields</strong> to provide suggestions, making the process of typing more efficient and reducing the risk of errors.</p>



<p class="wp-block-paragraph">Autocomplete works by displaying a list of possible values that match the user’s input. These suggestions are dynamically filtered based on the text entered and can come from different sources, such as <strong>local databases</strong>, <strong>external APIs</strong>, or <strong>predefined lists</strong>.</p>



<p class="wp-block-paragraph">This feature is a key element in improving <strong>usability</strong> and <strong>user experience (UX)</strong> by making data entry easier and faster. Autocomplete is widely used in web applications, search engines, <strong>e-commerce websites</strong>, <strong>content management systems</strong>, and more.</p>



<p class="wp-block-paragraph"><strong>Key Features of Autocomplete:</strong></p>



<ul class="wp-block-list">
<li><strong>Instant Suggestions</strong>: Provides users with relevant suggestions as they type.</li>



<li><strong>Search Optimization</strong>: Reduces the time spent typing by predicting what the user intends to enter.</li>



<li><strong>User-Friendly</strong>: Simplifies data entry and prevents common errors.</li>



<li><strong>Customizable</strong>: Allows developers to customize the list of suggestions based on various factors such as popularity, relevance, or user history.</li>



<li><strong>Dynamic</strong>: Suggestions update in real time based on the user’s input.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Major Use Cases of Autocomplete?</strong></h3>



<p class="wp-block-paragraph">Autocomplete is widely used across various applications to improve data entry, reduce errors, and enhance user experience. Below are some of the <strong>major use cases</strong>:</p>



<h4 class="wp-block-heading"><strong>1. Search Bar Suggestions:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is commonly used in search engines, websites, and apps to suggest search terms as users type in the search bar.</li>



<li><strong>Example</strong>: When a user types &#8220;co&#8221;, an autocomplete feature might suggest &#8220;coffee&#8221;, &#8220;cookies&#8221;, &#8220;computers&#8221;, etc., based on popular or recent searches.</li>



<li><strong>Why Autocomplete?</strong> It speeds up the search process by presenting suggestions, reducing the need for users to type full terms and improving <strong>search relevance</strong>.</li>
</ul>



<h4 class="wp-block-heading"><strong>2. Web Forms:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is often used in <strong>web forms</strong> to assist users in filling out <strong>address fields</strong>, <strong>email fields</strong>, or <strong>credit card details</strong>.</li>



<li><strong>Example</strong>: An <strong>address form</strong> may suggest completed addresses or city names based on the first few characters typed.</li>



<li><strong>Why Autocomplete?</strong> It reduces manual data entry and minimizes <strong>errors</strong> in forms by suggesting complete, formatted data.</li>
</ul>



<h4 class="wp-block-heading"><strong>3. E-Commerce and Product Search:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is heavily used in <strong>e-commerce platforms</strong> where users can search for products. It suggests products, brands, or categories as users begin typing.</li>



<li><strong>Example</strong>: On an <strong>e-commerce site</strong>, as a user types &#8220;laptop&#8221;, autocomplete can show suggestions for specific models like &#8220;MacBook Pro&#8221; or &#8220;Dell XPS&#8221;.</li>



<li><strong>Why Autocomplete?</strong> It enhances the <strong>shopping experience</strong> by helping users quickly find the products they’re interested in without needing to type out the full name.</li>
</ul>



<h4 class="wp-block-heading"><strong>4. Location-Based Search:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is widely used in <strong>location-based searches</strong>, helping users search for <strong>cities</strong>, <strong>countries</strong>, <strong>landmarks</strong>, or <strong>businesses</strong>.</li>



<li><strong>Example</strong>: A <strong>travel website</strong> can show autocomplete suggestions for popular destinations when users start typing a city name.</li>



<li><strong>Why Autocomplete?</strong> It helps users find <strong>location-based information</strong> faster, reducing ambiguity and improving <strong>search accuracy</strong>.</li>
</ul>



<h4 class="wp-block-heading"><strong>5. Tagging Systems:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is used in <strong>tagging systems</strong> where users can select tags or keywords to categorize content.</li>



<li><strong>Example</strong>: A <strong>blogging platform</strong> uses autocomplete to suggest tags for posts, such as &#8220;technology&#8221;, &#8220;art&#8221;, &#8220;design&#8221;, or &#8220;marketing&#8221;.</li>



<li><strong>Why Autocomplete?</strong> It makes it easier for users to select <strong>relevant tags</strong>, streamlining the content categorization process and ensuring consistency.</li>
</ul>



<h4 class="wp-block-heading"><strong>6. Code Editors and IDEs:</strong></h4>



<ul class="wp-block-list">
<li><strong>Use Case</strong>: Autocomplete is commonly used in <strong>code editors</strong> and <strong>Integrated Development Environments (IDEs)</strong> to suggest functions, variables, or methods as developers write code.</li>



<li><strong>Example</strong>: In <strong>Visual Studio Code</strong> or <strong>IntelliJ IDEA</strong>, autocomplete can suggest function names like <code>console.log()</code> or variables like <code>userName</code> based on the context of the code.</li>



<li><strong>Why Autocomplete?</strong> It <strong>boosts productivity</strong>, reduces the risk of typos, and helps developers navigate large codebases more effectively.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>How Autocomplete Works Along with Architecture?</strong></h3>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="472" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-1024x472.png" alt="" class="wp-image-13013" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-1024x472.png 1024w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-300x138.png 300w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-768x354.png 768w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-1536x708.png 1536w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2025/07/image-1-2048x944.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Autocomplete works by integrating with the input fields and querying appropriate data sources in real-time to offer suggestions. Its architecture typically includes the following components:</p>



<h4 class="wp-block-heading"><strong>1. Input Field:</strong></h4>



<ul class="wp-block-list">
<li>The <strong>input field</strong> is where users type their queries. As the user begins typing, the autocomplete system is triggered and starts retrieving relevant suggestions.</li>
</ul>



<h4 class="wp-block-heading"><strong>2. Event Handling:</strong></h4>



<ul class="wp-block-list">
<li><strong>JavaScript events</strong> like <code>input</code>, <code>keyup</code>, or <code>keydown</code> are used to track the user’s input. Each time a user types a character, the system listens for the event and initiates a query for suggestions.</li>



<li><strong>Example</strong>: When a user types &#8220;co&#8221; in a search bar, the system listens for input and triggers a call to a suggestion API.</li>
</ul>



<h4 class="wp-block-heading"><strong>3. Data Retrieval and Filtering:</strong></h4>



<ul class="wp-block-list">
<li>The autocomplete system <strong>queries a database</strong> or an <strong>API</strong> to retrieve a list of suggestions based on the user&#8217;s input. The data is then filtered to match the text entered.</li>



<li><strong>Data Sources</strong>:
<ul class="wp-block-list">
<li><strong>Local Dataset</strong>: Autocomplete might retrieve data from a <strong>local array</strong> or <strong>predefined list</strong> stored on the client side.</li>



<li><strong>API Calls</strong>: For more dynamic or large datasets, autocomplete queries a remote <strong>API</strong> to fetch suggestions (e.g., a search engine API or a product database).</li>
</ul>
</li>



<li><strong>Example</strong>: If a user types &#8220;mac&#8221;, the system queries the <strong>product database</strong> for suggestions like &#8220;MacBook Air&#8221; or &#8220;MacBook Pro&#8221;.</li>
</ul>



<h4 class="wp-block-heading"><strong>4. Ranking and Sorting Suggestions:</strong></h4>



<ul class="wp-block-list">
<li>After fetching suggestions, the system <strong>ranks</strong> or <strong>filters</strong> them to ensure the most relevant options are displayed first. The ranking can be based on <strong>popularity</strong>, <strong>previous searches</strong>, <strong>user behavior</strong>, or other ranking algorithms.</li>



<li><strong>Example</strong>: In an <strong>e-commerce store</strong>, the most popular products are displayed at the top of the suggestions list.</li>
</ul>



<h4 class="wp-block-heading"><strong>5. Display Suggestions:</strong></h4>



<ul class="wp-block-list">
<li>The autocomplete system <strong>displays suggestions</strong> in a dropdown or list format beneath the input field. Users can interact with these suggestions by clicking or navigating with the keyboard.</li>



<li><strong>Example</strong>: Suggestions like &#8220;coffee beans&#8221;, &#8220;coffee mugs&#8221;, and &#8220;coffee machines&#8221; are displayed in a dropdown under the search bar as the user types.</li>
</ul>



<h4 class="wp-block-heading"><strong>6. User Selection:</strong></h4>



<ul class="wp-block-list">
<li>When the user selects a suggestion, it is populated into the input field, and the appropriate action (e.g., search query submission) is triggered.</li>



<li><strong>Example</strong>: A user selects a suggestion from the dropdown, and the system performs the search or loads the relevant product page.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>What Are the Basic Workflow of Autocomplete?</strong></h3>



<p class="wp-block-paragraph">The basic workflow of an autocomplete system can be broken down into the following steps:</p>



<h4 class="wp-block-heading"><strong>1. Detecting User Input:</strong></h4>



<ul class="wp-block-list">
<li>As the user begins typing in the input field, the system listens for the <strong>input event</strong>. Each time a user types a character, the system begins processing the query.</li>



<li><strong>Example</strong>: A user starts typing &#8220;co&#8221; into a search bar.</li>
</ul>



<h4 class="wp-block-heading"><strong>2. Query Data Source:</strong></h4>



<ul class="wp-block-list">
<li>The system queries an appropriate <strong>data source</strong> (e.g., a local array or an API endpoint) to retrieve possible matches based on the input.</li>



<li><strong>Example</strong>: The system queries the <strong>product database</strong> or an <strong>external API</strong> to find matches for &#8220;co&#8221;.</li>
</ul>



<h4 class="wp-block-heading"><strong>3. Filter and Rank Suggestions:</strong></h4>



<ul class="wp-block-list">
<li>Once suggestions are retrieved, the system <strong>filters</strong> them based on the user&#8217;s input and <strong>ranks</strong> them by relevance. The most appropriate suggestions are displayed first.</li>



<li><strong>Example</strong>: The system filters results to show the most relevant items like &#8220;coffee&#8221;, &#8220;cookies&#8221;, or &#8220;comedy&#8221;.</li>
</ul>



<h4 class="wp-block-heading"><strong>4. Display Suggestions:</strong></h4>



<ul class="wp-block-list">
<li>The system displays the filtered suggestions in a dropdown list, allowing users to quickly scan and select the most relevant option.</li>



<li><strong>Example</strong>: A dropdown shows &#8220;coffee&#8221;, &#8220;cookies&#8221;, &#8220;comedy&#8221;, and other suggestions as the user types.</li>
</ul>



<h4 class="wp-block-heading"><strong>5. User Interaction and Selection:</strong></h4>



<ul class="wp-block-list">
<li>The user either selects a suggestion via <strong>click</strong> or <strong>keyboard navigation</strong>. Once a suggestion is selected, the selected text is populated into the input field.</li>



<li><strong>Example</strong>: A user selects &#8220;coffee beans&#8221; from the list, and the search field is populated with that text.</li>
</ul>



<h4 class="wp-block-heading"><strong>6. Trigger Action:</strong></h4>



<ul class="wp-block-list">
<li>Once a suggestion is selected, the autocomplete system can trigger the appropriate action, such as submitting a search, navigating to a product page, or filling out a form field.</li>



<li><strong>Example</strong>: After selecting a suggestion, the system initiates a <strong>search</strong> for &#8220;coffee beans&#8221; or redirects the user to the relevant product page.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity">



<h3 class="wp-block-heading"><strong>Step-by-Step Getting Started Guide for Autocomplete</strong></h3>



<p class="wp-block-paragraph">To implement an autocomplete feature, you can follow this simple step-by-step guide using <strong>JavaScript</strong> and <strong>jQuery</strong> (for simplicity).</p>



<h4 class="wp-block-heading"><strong>Step 1: Set Up the HTML Structure</strong></h4>



<ul class="wp-block-list">
<li>Create an input field where users can type their query.</li>
</ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&amp;lt;input type=&quot;text&quot; id=&quot;search&quot; placeholder=&quot;Search for items...&quot;&amp;gt;
&amp;lt;ul id=&quot;suggestions&quot;&amp;gt;&amp;lt;/ul&amp;gt;  &amp;lt;!-- List to display suggestions --&amp;gt;

</pre></div>


<h4 class="wp-block-heading"><strong>Step 2: Add JavaScript for User Input Detection</strong></h4>



<ul class="wp-block-list">
<li>Add a JavaScript event listener to capture input events and trigger the search.</li>
</ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
document.getElementById(&#039;search&#039;).addEventListener(&#039;input&#039;, function() {
    let query = this.value;
    if(query.length &amp;gt; 2) {  // Trigger search only if query length is greater than 2
        getSuggestions(query);
    }
});

</pre></div>


<h4 class="wp-block-heading"><strong>Step 3: Create a Function to Fetch Suggestions</strong></h4>



<ul class="wp-block-list">
<li>Write a function to fetch suggestions based on the user input.</li>
</ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
function getSuggestions(query) {
    // Example API call or static data retrieval
    const suggestions = &#x5B;&#039;coffee beans&#039;, &#039;cookies&#039;, &#039;comedy&#039;, &#039;coca-cola&#039;];
    const filteredSuggestions = suggestions.filter(item =&amp;gt; item.toLowerCase().includes(query.toLowerCase()));
    displaySuggestions(filteredSuggestions);
}

</pre></div>


<h4 class="wp-block-heading"><strong>Step 4: Display the Suggestions</strong></h4>



<ul class="wp-block-list">
<li>Create a function to display the filtered suggestions in the <strong>suggestions list</strong>.</li>
</ul>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
function displaySuggestions(suggestions) {
    let suggestionsList = document.getElementById(&#039;suggestions&#039;);
    suggestionsList.innerHTML = &#039;&#039;;
    suggestions.forEach(item =&amp;gt; {
        let li = document.createElement(&#039;li&#039;);
        li.textContent = item;
        li.onclick = function() {
            document.getElementById(&#039;search&#039;).value = item;
            suggestionsList.innerHTML = &#039;&#039;;  // Clear suggestions
        };
        suggestionsList.appendChild(li);
    });
}

</pre></div>


<h4 class="wp-block-heading"><strong>Step 5: Test and Refine</strong></h4>



<ul class="wp-block-list">
<li>Test your autocomplete feature and make adjustments for better <strong>performance</strong>, <strong>usability</strong>, and <strong>styling</strong>. You can refine the filtering, add <strong>keyboard navigation</strong>, or integrate <strong>APIs</strong> to fetch dynamic data.</li>
</ul>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/complete-guide-to-autocomplete-use-cases-architecture-workflow-and-getting-started/">Complete Guide to Autocomplete: Use Cases, Architecture, Workflow, and Getting Started</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/complete-guide-to-autocomplete-use-cases-architecture-workflow-and-getting-started/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HTML: Form Tag</title>
		<link>https://www.scmgalaxy.com/tutorials/html-form-tag/</link>
					<comments>https://www.scmgalaxy.com/tutorials/html-form-tag/#respond</comments>
		
		<dc:creator><![CDATA[vikashdev k]]></dc:creator>
		<pubDate>Mon, 09 Aug 2021 05:37:09 +0000</pubDate>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[action attribute]]></category>
		<category><![CDATA[autocomplete]]></category>
		<category><![CDATA[Enctype Attribute]]></category>
		<category><![CDATA[form tag in html]]></category>
		<category><![CDATA[Get]]></category>
		<category><![CDATA[html form tag]]></category>
		<category><![CDATA[html tag]]></category>
		<category><![CDATA[input tag inside form tag in html]]></category>
		<category><![CDATA[method attribute]]></category>
		<category><![CDATA[min and max]]></category>
		<category><![CDATA[name attribute]]></category>
		<category><![CDATA[novalidate]]></category>
		<category><![CDATA[Post]]></category>
		<category><![CDATA[Text direction(dirname)]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7607</guid>

					<description><![CDATA[<p>HTML forms are used to collect some data from the site visitor. The HTML &#60;form&#62;…..&#60;/form&#62; tag is used to create [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/html-form-tag/">HTML: Form Tag</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">HTML forms are used to collect some data from the site visitor. The HTML &lt;form&gt;…..&lt;/form&gt; tag is used to create an HTML form.</p>



<pre class="wp-block-code"><code>&lt;input&gt;
&lt;textarea&gt;
&lt;button&gt;
&lt;select&gt;
&lt;option&gt;
&lt;optgroup&gt;
&lt;fieldset&gt;
&lt;label&gt;
</code></pre>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>Attribute</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>accept-charset</td><td>UTF-8</td><td>Specifies the charset used in the submitted form (default: the page charset).</td></tr><tr><td>action</td><td>URL</td><td>Contains a URL that defines where to send the data after submitting the form</td></tr><tr><td>autocomplete</td><td>On (default)<br>Off</td><td>Determines that the browser retains the history of previous values.</td></tr><tr><td>enctype</td><td> (default: is url-encoded)</td><td>specifies how the browser encodes the data before it sends it to the server.</td></tr><tr><td>method</td><td>GET (default)<br>POST</td><td>Specifies how to send the form data to a web server. The data can be sent as URL variables, by using the get method or as HTTP post, by using the post method</td></tr><tr><td>name</td><td>name</td><td>Specifies a name used to identify the form</td></tr><tr><td>novalidate</td><td>novalidate</td><td>Specifies that the browser should not validate the form.</td></tr><tr><td>target</td><td>_self (default)<br>_blank<br>_parent<br>_top<br>framename</td><td>Specifies the target of the address in the action attribute</td></tr></tbody></table></figure>



<h2 class="wp-block-heading"><strong>Input Tag</strong></h2>



<p class="wp-block-paragraph">&lt;input&gt; tag prompts the user to enter data and also request for the information from the web server after submitting the web form.</p>



<pre class="wp-block-code"><code>&lt;form&gt;
	&lt;input&gt;
&lt;/form&gt;
No input end tag in HTML5
</code></pre>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>Attribute</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>accept</td><td>file_extension<br>audio/*<br>video/*<br>image/*<br>media_type</td><td>Specifies the types of files that the server accepts</td></tr><tr><td>alt</td><td>text</td><td>Specifies an alternate text for an image. only used with type=“image”</td></tr><tr><td>autocomplete</td><td>on<br>off</td><td>It enables or disable autocomplete in &lt;input&gt; tag</td></tr><tr><td>autofocus</td><td>autofocus</td><td>Specifies that an &lt;input&gt; element should automatically get focus when the page loads</td></tr><tr><td>checked</td><td>checked</td><td>Input element should be checked/selected when a web page loads. It is used only with &nbsp;type=”checkbox” and type=”radio”</td></tr><tr><td>dirname</td><td>inputname.dir</td><td>Specifies that the text direction will be submitted</td></tr><tr><td>disabled</td><td>disabled</td><td>Disables the input element when it loads on the client side’s web page, so that user cannot write text in it or select it. This attribute cannot be used with type=“hidden”</td></tr><tr><td>form</td><td>form_id</td><td>Specifies form’s id to which the input field belongs.</td></tr><tr><td>formaction</td><td>URL</td><td>Specifies the URL of the file that will process the input control when the form is submitted</td></tr><tr><td>formenctype</td><td>application/x-www-form-urlencoded<br>multipart/form-data<br>text/plain</td><td>Specifies how the form-data should be encoded when submitting it to the server</td></tr><tr><td>formmethod</td><td>GET<br>POST</td><td>Defines the HTTP method for sending data to the action URL</td></tr><tr><td>formnovalidate</td><td>formnovalidate</td><td>Defines that form elements should not be validated when submitted</td></tr><tr><td>formtarget</td><td>_blank<br>_self<br>_parent<br>_top<br>framename</td><td>Specifies where to display the response that is received after submitting the form</td></tr><tr><td>height</td><td>pixels</td><td>Indicates the height of an input field</td></tr><tr><td>list</td><td>Id of a datalist</td><td>Contains the id of the &lt;datalist&gt; tag where a datalist element contains various options for an input field</td></tr><tr><td>max</td><td>number<br>date</td><td>Specifies the maximum value for an &lt;input&gt; element<br>number, range, date, datetime-local, month, time and week.</td></tr><tr><td>maxlength<br>minlength</td><td>number</td><td>Specifies the maximum/minimum number of characters allowed in a text field.</td></tr><tr><td>min</td><td>number<br>date</td><td>Specifies a minimum value for an &lt;input&gt; element<br>number, range, date, datetime-local, month, time and week.</td></tr><tr><td>multiple</td><td>multiple</td><td>Indicates whether the user is allowed to enter more than one value</td></tr><tr><td>name</td><td>text</td><td>Defines a unique name for the input element.</td></tr><tr><td>pattern</td><td>regexp</td><td>Specifies a regular expression that an &lt;input&gt; element&#8217;s value is checked against</td></tr><tr><td>placeholder</td><td>text</td><td>Specifies a short hint that describes the expected value<br>text, search, url, tel, email, and password</td></tr><tr><td>readonly</td><td>readonly</td><td>Indicates that the value of this field cannot be modified.</td></tr><tr><td>required</td><td>required</td><td>Specifies that an input field must be filled out before submitting the form</td></tr><tr><td>size</td><td>number</td><td>Specifies the width of the control. If type=&#8221;text&#8221; or type=&#8221;password&#8221; this refers to the width in characters. Otherwise it&#8217;s in pixels.</td></tr><tr><td>src</td><td>URL</td><td>Defines the URL of the image to display. It can be used only with type=“image”</td></tr><tr><td>step</td><td>number</td><td>Specifies the legal number intervals for an input field</td></tr><tr><td>type</td><td>button<br>checkbox<br>color<br>date&nbsp;<br>datetime&nbsp;<br>datetime-local&nbsp;<br>email&nbsp;<br>file<br>hidden<br>image<br>month&nbsp;<br>number&nbsp;<br>password<br>radio<br>range&nbsp;<br>reset<br>search<br>submit<br>tel<br>text<br>time&nbsp;<br>url<br>week</td><td>Indicates the type of the input element. The default value is text.</td></tr><tr><td>value</td><td>text</td><td>Specifies the value of an &lt;input&gt; element</td></tr><tr><td>width</td><td>pixels</td><td>Indicates the width of an input field</td></tr></tbody></table></figure>



<h2 class="wp-block-heading"><strong>Type Attribute</strong></h2>



<p class="wp-block-paragraph">It indicates the type of input element. It’s an empty tag. The default value is text.</p>



<p class="wp-block-paragraph">Ex: &#8211;</p>



<pre class="wp-block-code"><code>&lt;input&gt; 
&lt;input type=“text”&gt;
</code></pre>



<ul class="wp-block-list"><li>Text – It defines a single-line text field.                                                                                           <strong>&lt;input type=“text”&gt;</strong></li><li>Password – A password field is like text field, the difference being that this control hides each typed character by displaying an asterisk(*) or bullets(●) instead of the character itself.                         <strong>&lt;input type=“password”&gt;</strong></li><li>Button – This is used to add a button on a web form to activate a script when an user click the button.                                                                                                                                             <strong>&lt;input type=“button”&gt;</strong></li><li>Email – This field is used to add an email address or a list of email address to a form, where type=“email” is a value for the input type. The input format should be an email like example@gmail.com else it will prompt an error.                                                                           <strong>&lt;input type=“email”&gt;</strong></li><li>Check Box – A check box is a small box, which when selected includes a checkmark. It is used to allow the user to select one or more than one of the options available on a web page. An User can select or clear the check box by clicking it.                                                                                                      <strong>&lt;input type=“checkbox”&gt;</strong></li><li>Radio Button – A radio button is used to create a series of options of which only one can be selected. It is displayed as a circle which when selected, displays a dot in the middle.                                    <strong>&lt;input type=“radio”&gt;</strong></li><li>•URL &#8211; The URL field is used to enter only the web addresses, in their correct format. If the URL is not entered in the correct format then the URL field validates the text field to enter web address.    <strong>&lt;input type=“url”&gt;</strong>                                                                                                                       Autofocus – helps in keeping the focus of mouse pointer on the input field.                                Pattern – defines the regular expression of the text that should be entered in the text field.</li><li>Search Box – This is used to add a search box to a form.                                                                   <strong>&lt;input type=“search”&gt;</strong></li><li>Tel &#8211; The tel type represents a one-line plain-text edit for entering a telephone number.                      <strong>&lt;input type=“tel”&gt;</strong></li><li>Range &#8211; Range input represents the input of limited range numerical values.                                     <strong>&lt;input type=“range”&gt;</strong></li><li>Number &#8211; Number is used to validate the textbox only if the value within the field is a numerical value.                                                                                                                                                <strong>&lt;input type=“number”&gt;</strong></li><li>File – This is used to upload a file on a web page. You also need to set the enctype=“multipart/form-data”.                                                                                                                                                <strong>&lt;input type=“file”&gt;</strong></li><li>Image – It represents either an image from which the UA enables a user to interactively select a pair of coordinates and submit the form, or alternatively a button from which the user can submit the form.                                                                                                                                                         <strong>&lt;input type=“image”&gt;</strong></li><li>Hidden – A hidden control stores the data that is not visible to the user on a web page. This control is used to submit some information, which can not be edited by user.                                                     <strong>&lt;input type=“hidden”&gt;</strong></li><li>Submit – A submit button is used to transfer form data to the URL specified in the &lt;form action&gt; tag.<strong>&lt;input type=“submit”&gt;</strong></li><li>Reset Button – A reset button helps user to clear all the data that they have entered in the text fields.<strong>&lt;input type=“reset”&gt;</strong></li><li>Date – This is used for input fields that should contain a date.                                                      <strong>&lt;input type=“date”&gt;</strong></li><li>Time – It allows the user to select a time.                                                                                        <strong>&lt;input type=“time”&gt;</strong></li><li><span class="has-inline-color has-black-color">DateTime</span> – It allows the user to select&nbsp; date and time.                                                                             <strong>&lt;input type=“datetime”&gt;</strong></li><li>Datetime-local – It allows the user to select a date and time.                                                         <strong>&lt;input type=“datetime-local”&gt;</strong></li><li>Month – It allows the user to select a month and year.                                                                  <strong>&lt;input type=“month”&gt;</strong></li><li>Week – It allows the user to select a week and year.                                                                         <strong>&lt;input type=“week”&gt;</strong></li><li>Color – It is used for input fields that should contain a color.                                                         <strong>&lt;input type=“color”&gt;</strong></li></ul>



<h2 class="has-text-align-center wp-block-heading"><strong>accept-charset Attribute</strong></h2>



<p class="wp-block-paragraph">It specifies the character encodings that are to be used for the form submission.</p>



<p class="wp-block-paragraph"><strong>ISO-8859-1</strong> Character encoding for the Latin alphabet</p>



<p class="wp-block-paragraph"><strong>UTF-8</strong> Character encoding for Unicode</p>



<pre class="wp-block-code"><code>&lt;form accept-charset=“UTF-8”&gt;
</code></pre>



<h2 class="has-text-align-center wp-block-heading"><strong>Action Attribute</strong></h2>



<p class="wp-block-paragraph">It contains a URL that defines where to send the data after submitting the form. It specifies the physical address of the server to which the user data should be redirected at the click of the submit button.       action=http://www.something.com/something.html                                                            action=“page.html”                                                                                                                   action=“gotform.php”                                                                                                         action=“example.asp”</p>



<p class="wp-block-paragraph">If the action attribute is omitted, the action is set to the current page.</p>



<h2 class="has-text-align-center wp-block-heading"><strong>Autocomplete</strong></h2>



<p class="wp-block-paragraph">On – The browser will automatically complete values based on values that the user has entered before.         Off – User need to write all values each time they fill the form                                                            &lt;form autocomplete=“on”&gt;</p>



<h2 class="has-text-align-center wp-block-heading"><strong>enctype Attribute</strong></h2>



<p class="wp-block-paragraph">It specifies how the browser encodes the data before it sends it to the server.</p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>application/x-www-form-urlencoded</td><td>All characters are encoded before sent (spaces are converted to &#8220;+&#8221; symbols, and special characters are converted to ASCII HEX values)</td></tr><tr><td>multipart/form-data</td><td>No characters are encoded. This value is required when you are using forms that have a file upload control</td></tr><tr><td>text/plain</td><td>Spaces are converted to &#8220;+&#8221; symbols, but no special characters are encoded</td></tr></tbody></table></figure>



<pre class="wp-block-code"><code>&lt;form enctype=“multipart/form-data”&gt;
</code></pre>



<h2 class="has-text-align-center wp-block-heading"><strong>Method Attribute</strong></h2>



<p class="wp-block-paragraph">It Specifies how to send the form data to a web server. The data can be sent as URL variables, by using the get method or as HTTP post, by using the post method.</p>



<ul class="wp-block-list"><li>GET(default)</li><li>POST</li></ul>



<h2 class="has-text-align-center wp-block-heading">GET</h2>



<p class="wp-block-paragraph">GET sends the data as part of the URL.</p>



<ul class="wp-block-list"><li>Appends form-data into the URL in name/value pairs.</li><li>The length of a URL is limited 2048 characters.</li><li>Never use GET method if you have password or other sensitive information to be sent to the server.</li><li>Useful for form submissions where a user want to bookmark the result.</li><li>GET is better for non-secure data, like query strings in Google.</li><li>GET can&#8217;t be used to send binary data, ex:-&nbsp; images or word documents.</li></ul>



<pre class="wp-block-code"><code>&lt;form action=“some.php” method = “GET”&gt;
</code></pre>



<p class="wp-block-paragraph">If we use an invalid value for the method attribute of the &lt;form&gt; tag, the browser will use the default value GET.</p>



<h2 class="has-text-align-center wp-block-heading"><strong>POST</strong></h2>



<p class="wp-block-paragraph">HTTP POST requests supply additional data from the client (browser) to the server in the message body.</p>



<ul class="wp-block-list"><li>Appends form-data inside the body of the HTTP request (data is not shown is in URL).</li><li>The POST method does not have any restriction on data size to be sent.</li><li>Form submissions with POST cannot be bookmarked.</li><li>The POST method can be used to send ASCII as well as binary data. Ex:-&nbsp; image and word documents etc.</li><li>The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure.</li><li>POST is a little safer than GET because the parameters are not stored in browser history or in web server logs.</li></ul>



<pre class="wp-block-code"><code>&lt;form action=“some.php” method = “POST”&gt;
</code></pre>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td></td><td><strong>GET</strong></td><td><strong>POST</strong></td></tr><tr><td>BACK button/Reload</td><td>Harmless</td><td>Data will be re-submitted (the browser should alert the user that the data are about to be re-submitted)</td></tr><tr><td>Bookmarked</td><td>Can be bookmarked</td><td>Cannot be bookmarked</td></tr><tr><td>Cached</td><td>Can be cached</td><td>Not cached</td></tr><tr><td>Encoding type</td><td>application/x-www-form-urlencoded</td><td>application/x-www-form-urlencoded or multipart/form-data. Use multipart encoding for binary data</td></tr><tr><td>History</td><td>Parameters remain in browser history</td><td>Parameters are not saved in browser history</td></tr><tr><td>Restrictions on data type</td><td>Only ASCII characters allowed</td><td>No restrictions. Binary data is also allowed</td></tr><tr><td>Visibility</td><td>Data is visible to everyone in the URL</td><td>Data is not displayed in the URL</td></tr></tbody></table></figure>



<h2 class="has-text-align-center wp-block-heading"><strong>Name&nbsp; Attribute</strong></h2>



<p class="wp-block-paragraph">Specifies a name used to identify the form.                                                                                                  It is Used to give a name to the control which is sent to the server to be recognized and get the value.                                                                             name=“lastname”</p>



<h2 class="has-text-align-center wp-block-heading"><strong>novalidate</strong></h2>



<p class="wp-block-paragraph">If we use novalidate attribute in form tag then the validation will not take place, even if there is a required filed.</p>



<pre class="wp-block-code"><code>&lt;form novalidate&gt;
&lt;form novalidate=“novalidate”&gt; 
&lt;form novalidate=“true”&gt; 
</code></pre>



<p class="wp-block-paragraph">There is one more tag formnovalidate which is used by input tag to speficiy novlidate this particular text or field we will study about this later.</p>



<h2 class="has-text-align-center wp-block-heading"><strong>Text Direction (dirname)</strong></h2>



<p class="wp-block-paragraph">Specifies that the text direction will be submitted</p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td><strong>Value</strong></td><td><strong>Description</strong></td></tr><tr><td>ltr</td><td>Default. Left-to-right text direction</td></tr><tr><td>rtl</td><td>Right-to-left text direction</td></tr><tr><td>auto</td><td>Let the browser figure out the text direction, based on the content</td></tr></tbody></table></figure>



<pre class="wp-block-code"><code>&lt;input type=“text” name=“city” dirname=“city.dir”&gt;
</code></pre>



<h2 class="has-text-align-center wp-block-heading"><strong>Min and Max</strong></h2>



<p class="wp-block-paragraph">number, range, date, datetime-local, month, time and week.</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/html-form-tag/">HTML: Form Tag</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/html-form-tag/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
