Skip to content

Commit cc65d62

Browse files
authored
Merge pull request #4602 from codeharborhub/dev-3
Dev 3
2 parents a60f6f4 + 83721a2 commit cc65d62

File tree

9 files changed

+816
-29
lines changed

9 files changed

+816
-29
lines changed

Learn.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Visit our website [CodeHarbourHub](https://www.codeharborhub.live/)
33

44
## Table of Contents
55

6-
- [Introduction](#introduction)
7-
- [Features](#features)
8-
- [Contributing Guidelines](#contributing-guidelines)
9-
- [Code of Conduct](#code-of-conduct)
10-
- [Socials](#socials)
6+
- [CodeHarbourHub](#codeharbourhub)
7+
- [Table of Contents](#table-of-contents)
8+
- [Introduction](#introduction)
9+
- [Features](#features)
10+
- [Contributing Guidelines](#contributing-guidelines)
11+
- [Code of Conduct](#code-of-conduct)
12+
- [Socials](#socials)
1113

1214
## Introduction
1315

@@ -16,16 +18,16 @@ We're the exclusive platform offering a comprehensive tech curriculum, taught by
1618

1719
## Features
1820
- **In-Depth Tutorials**: Dive into comprehensive tutorials covering a wide range of programming languages like C++, Java, Python, JavaScript and Typescript and frameworks like ReactJS along with Data Structures and Algorithms.
19-
![](/assets/Tutorials.png)
21+
<!-- ![](/assets/Tutorials.png) -->
2022

2123
- **Courses for Mastery**: Enroll in structured courses designed to take your skills to the next level. They range from learning a particular language and implementing them hands-on as projects to enhance learning.
22-
![](/assets/Courses.png)
24+
<!-- ![](/assets/Courses.png) -->
2325

2426
- **Inspiring Showcases**: Explore inspiring showcases of real-world projects and innovative web solutions.
25-
![](/assets/Showcase.png)
27+
<!-- ![](/assets/Showcase.png) -->
2628

2729
- **Engaging Community**: Connect with a vibrant community of developers, share knowledge, and collaborate on projects.
28-
![](/assets/Community.png)
30+
<!-- ![](/assets/Community.png) -->
2931

3032
## Contributing Guidelines
3133

community/Learn.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
id: learn
3+
title: Welcome to CodeHarbourHub
4+
sidebar_label: Learn
5+
sidebar_position: 6
6+
---
7+
8+
Visit our website [CodeHarbourHub](https://codeharborhub.github.io/)
9+
10+
## Introduction
11+
12+
Welcome to "CodeHarbourHub" - Our mission at CodeHarbourHub to provide accessible and comprehensive educational resources to learners of all levels, from Beginners learners to Advanced professionals.
13+
We're the exclusive platform offering a comprehensive tech curriculum, taught by industry masters, completely free. Join our vibrant community, master in-demand skills, and launch your dream tech career.
14+
15+
## Features
16+
- **In-Depth Tutorials**: Dive into comprehensive tutorials covering a wide range of programming languages like C++, Java, Python, JavaScript and Typescript and frameworks like ReactJS along with Data Structures and Algorithms.
17+
<!-- ![](/assets/Tutorials.png) -->
18+
19+
- **Courses for Mastery**: Enroll in structured courses designed to take your skills to the next level. They range from learning a particular language and implementing them hands-on as projects to enhance learning.
20+
<!-- ![](/assets/Courses.png) -->
21+
22+
- **Inspiring Showcases**: Explore inspiring showcases of real-world projects and innovative web solutions.
23+
<!-- ![](/assets/Showcase.png) -->
24+
25+
- **Engaging Community**: Connect with a vibrant community of developers, share knowledge, and collaborate on projects.
26+
<!-- ![](/assets/Community.png) -->
27+
28+
## Contributing Guidelines
29+
30+
For the enthusiasts who want to contribute to CodeHarbourHub, please refer to our [Contributing Guildelines](https://github.com/CodeHarborHub/codeharborhub/blob/main/CONTRIBUTING.md)
31+
32+
## Code of Conduct
33+
34+
For all the enthusiastic contributers, please refer to the [Code of Conduct](https://github.com/CodeHarborHub/codeharborhub/blob/main/CODE_OF_CONDUCT.md)
35+
36+
## Socials
37+
Stay updated with the latest news and announcements:
38+
- [LinkedIn](https://www.linkedin.com/groups/14232119/)
39+
- [Twitter](https://twitter.com/CodesWithAjay)

courses/index.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ Our courses are designed to help you learn new skills and advance your career. W
2424

2525
Explore our courses to find the one that suits your interests and goals. Whether you are looking to learn a new programming language, build a web application, analyze data, or improve your project management skills, we have a course for you. Start your learning journey today!
2626

27-
import courses from '@site/src/data/courses';
27+
<!-- import courses from '@site/src/data/courses'; -->
2828

29-
<Courses courses={courses} />
29+
<!-- <Courses courses={courses} /> -->
30+
31+
<!-- ====== OR ============= -->
32+
33+
<!--
34+
import courses from '@site/src/database/courses';
35+
36+
<Courses courses={courses} /> -->
3037

3138
To get started, select a course from the list above or explore our recommended courses below. If you have any questions or need help, feel free to reach out to us.
3239

courses/recommend.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/html/forms/building-form.md

Lines changed: 216 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,218 @@
11
---
2+
id: building-forms
3+
title: Building Forms in HTML
4+
sidebar_label: Building Forms
5+
sidebar_position: 1
6+
tags: [html, web-development, forms, user-input, front-end-development, web-design]
7+
description: Learn how to create forms in HTML to collect user input effectively, with detailed examples and best practices.
8+
---
9+
10+
Forms are an essential part of any website or web application. They allow users to interact with the website by providing input, such as text, selections, and buttons. Forms are used for various purposes, such as user registration, login, search, feedback, and more.
11+
12+
<AdsComponent />
13+
14+
In this tutorial, you will learn how to create forms in HTML to collect user input effectively.
15+
16+
## Creating a Simple Form
17+
18+
To create a form in HTML, you need to use the `<form>` element. The `<form>` element is used to define an HTML form that collects user input. Here's an example of a simple form that collects the user's name and email address:
19+
20+
```html title="index.html" showLineNumbers
21+
<!DOCTYPE html>
22+
<html lang="en">
23+
<head>
24+
<meta charset="UTF-8">
25+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
26+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
27+
<title>Simple Form</title>
28+
</head>
29+
<body>
30+
<h1>Simple Form</h1>
31+
<form>
32+
<label for="name">Name:</label>
33+
<input type="text" id="name" name="name" required>
34+
<br><br>
35+
<label for="email">Email:</label>
36+
<input type="email" id="email" name="email" required>
37+
<br><br>
38+
<button type="submit">Submit</button>
39+
</form>
40+
</body>
41+
</html>
42+
```
43+
44+
In the example above:
45+
- We have created a simple form that collects the user's name and email address.
46+
- The `<form>` element contains two `<input>` elements for the name and email fields.
47+
- The `type="text"` attribute specifies that the input field is a text field.
48+
- The `type="email"` attribute specifies that the input field is an email field, which helps in validating the email address.
49+
- The `required` attribute specifies that the input field is required and must be filled out before submitting the form.
50+
- The `<button>` element with `type="submit"` is used to submit the form.
51+
52+
When the user submits the form by clicking the "Submit" button, the form data is sent to the server for processing. You can handle the form submission using JavaScript or server-side technologies like PHP, Node.js, etc.
53+
54+
<AdsComponent />
55+
56+
## Form Elements
57+
58+
HTML provides various form elements that you can use to collect different types of user input. Some commonly used form elements include:
59+
60+
### `<input>` Element
61+
62+
The `<input>` element is used to create input fields within a form. It can be used to create text fields, checkboxes, radio buttons, buttons, and more. The `type` attribute of the `<input>` element specifies the type of input field to be created.
63+
64+
Here are some common input types:
65+
66+
1. **text:** Creates a single-line text input field.
67+
68+
For example:
69+
```html title="index.html"
70+
<input type="text" name="username">
71+
```
72+
73+
2. **password:** Creates a password input field where the entered text is masked.
74+
75+
For example:
76+
```html title="index.html"
77+
<input type="password" name="password">
78+
```
79+
80+
3. **email:** Creates an email input field that validates the input as an email address.
81+
82+
For example:
83+
```html title="index.html"
84+
<input type="email" name="email">
85+
```
86+
87+
4. **checkbox:** Creates a checkbox input field that allows the user to select multiple options.
88+
89+
For example:
90+
```html title="index.html"
91+
<input type="checkbox" name="interest" value="coding"> Coding
92+
<input type="checkbox" name="interest" value="design"> Design
93+
```
94+
95+
5. **radio:** Creates a radio button input field that allows the user to select a single option from a list.
96+
97+
For example:
98+
```html title="index.html"
99+
<input type="radio" name="major" value="cs"> Computer Science
100+
<input type="radio" name="major" value="eng"> Engineering
101+
```
102+
103+
6. **submit:** Creates a submit button that submits the form data to the server.
104+
105+
For example:
106+
```html title="index.html"
107+
<input type="submit" value="Submit">
108+
```
109+
110+
7. **button:** Creates a button that can be used to trigger JavaScript functions.
111+
112+
For example:
113+
```html title="index.html"
114+
<button type="button" onclick="alert('Hello!')">Click Me</button>
115+
```
116+
117+
<AdsComponent />
118+
119+
### `<select>` Element
120+
121+
The `<select>` element is used to create a dropdown list within a form. It allows the user to select one or more options from a list of predefined options.
122+
123+
Here's an example of a `<select>` element with multiple options:
124+
125+
```html title="index.html"
126+
<select name="country">
127+
<option value="us">United States</option>
128+
<option value="ca">Canada</option>
129+
<option value="uk">United Kingdom</option>
130+
</select>
131+
```
132+
133+
### `<textarea>` Element
134+
135+
The `<textarea>` element is used to create a multi-line text input field within a form. It allows users to enter multiple lines of text, such as comments or feedback.
136+
137+
Here's an example of a `<textarea>` element:
138+
139+
```html title="index.html"
140+
<textarea name="comments" rows="4" cols="50"></textarea>
141+
```
142+
143+
In the example above, the `rows` and `cols` attributes specify the number of rows and columns of the textarea, respectively.
144+
145+
## Form Validation
146+
147+
Form validation is an essential part of creating forms to ensure that the user input is correct and complete. HTML provides built-in form validation features that can be used to validate user input without writing custom JavaScript code.
148+
149+
Here are some common form validation attributes that can be added to form elements:
150+
151+
- **required:** Specifies that the input field is required and must be filled out.
152+
- **minlength:** Specifies the minimum length of the input field.
153+
- **maxlength:** Specifies the maximum length of the input field.
154+
- **pattern:** Specifies a regular expression pattern that the input field must match.
155+
- **type:** Specifies the type of input field (e.g., email, number, date).
156+
- **min:** Specifies the minimum value for number and date input fields.
157+
158+
Here's an example of a form with validation attributes:
159+
160+
```html title="index.html"
161+
<form>
162+
<label for="username">Username:</label>
163+
<input type="text" id="username" name="username" required minlength="3">
164+
<br><br>
165+
<label for="password">Password:</label>
166+
<input type="password" id="password" name="password" required minlength="6">
167+
<br><br>
168+
<button type="submit">Submit</button>
169+
</form>
170+
```
171+
172+
In the example above:
173+
174+
- The `required` attribute specifies that both the username and password fields are required.
175+
- The `minlength="3"` attribute specifies that the username must be at least 3 characters long.
176+
- The `minlength="6"` attribute specifies that the password must be at least 6 characters long.
177+
178+
When the user submits the form, the browser will automatically validate the input fields based on the specified attributes. If the input is invalid, the browser will display an error message to the user.
179+
180+
<AdsComponent />
181+
182+
:::tip Key Components
183+
1. **`<form>` Tag**
184+
- Defines the start and end of a form.
185+
- Attributes:
186+
- `action`: URL where form data is sent.
187+
- `method`: HTTP method (e.g., `GET` or `POST`).
188+
189+
2. **Input Elements**
190+
- **Text Input (`<input type="text">`)**: Single-line text input.
191+
- **Email Input (`<input type="email">`)**: Input validation for email addresses.
192+
- **Textarea (`<textarea>`)**: Multi-line text input.
193+
194+
3. **Labels**
195+
- The `<label>` element improves accessibility by associating text with form controls.
196+
197+
4. **Submit Button**
198+
- `<button>` or `<input type="submit">` submits the form.
199+
200+
5. **Validation Attributes**
201+
- `required`, `minlength`, `maxlength`, `pattern`, etc.
202+
203+
:::
204+
205+
## Best Practices for Building Forms
206+
207+
When building forms in HTML, it's essential to follow best practices to create user-friendly and accessible forms. Here are some best practices for building forms:
208+
209+
- **Use Labels**: Always use the `<label>` element to associate text with form controls. This improves accessibility and makes it easier for users to understand the purpose of each input field.
210+
- **Provide Feedback**: Use validation attributes and error messages to provide feedback to users when they enter invalid data. This helps users correct their mistakes and complete the form successfully.
211+
- **Group Related Fields**: Group related form fields together using fieldsets and legends. This helps users understand the relationship between different fields and improves the overall form structure.
212+
- **Use Placeholder Text**: Use the `placeholder` attribute to provide hints or examples of the expected input in the form fields. Placeholder text disappears when the user starts typing.
213+
214+
By following these best practices, you can create forms that are easy to use, accessible, and user-friendly.
215+
216+
## Conclusion
2217

3-
---
218+
In this tutorial, you learned how to create forms in HTML to collect user input effectively. You also learned about various form elements, form validation, and best practices for building forms.

0 commit comments

Comments
 (0)