Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ff027b3
feat(new-page): add hello button to new page
Oct 23, 2025
00e72e8
Merge pull request #1 from feature/add-hello-button-on-new-page-4tw
dhruvsoni365 Oct 23, 2025
1c06336
feat(landing): add welcome page for users
Oct 23, 2025
f23330a
feat(angular-form): create name and email inputs
Oct 23, 2025
a2f85d4
Merge pull request #3 from feature/landing-page-welcome-6d0
dhruvsoni365 Oct 23, 2025
2a01840
Merge pull request #2 from feature/angular-form-name-email-7sy
dhruvsoni365 Oct 23, 2025
11ad92e
feat(page): add page that says hello
Oct 23, 2025
518e92c
Merge pull request #4 from feature/add-hello-page-iuz
dhruvsoni365 Oct 23, 2025
fb428d5
feat(page): add hello page and a hello there! button
Oct 23, 2025
b1ad850
Merge pull request #5 from feature/add-hello-page-iuz
dhruvsoni365 Oct 23, 2025
fd95079
feat(page): add contact details page
Oct 23, 2025
07d67be
Merge pull request #6 from feature/add-contact-page-dh6
dhruvsoni365 Oct 23, 2025
31ad899
feat(ui): add small button on new page
Oct 23, 2025
be7affd
Merge pull request #7 from feature/add-small-button-on-new-page-hpy
dhruvsoni365 Oct 23, 2025
9adbaff
feat(website): add about us page
Oct 23, 2025
39bb633
Merge pull request #9 from feature/about-us-page-ukl
dhruvsoni365 Oct 23, 2025
cedc30b
feat(names-table): add table of random names and phone numbers
Oct 23, 2025
58948ac
Merge pull request #10 from dhruvsoni365/feature/names-table-on-new-p…
dhruvsoni365 Oct 23, 2025
a0c7398
feat(page): add small greeting button page
Oct 23, 2025
d4ba4b2
Merge pull request #11 from dhruvsoni365/feature/quick-greeting-page-va4
dhruvsoni365 Oct 23, 2025
a905f17
feat(new-page): add table of 5 random names
Oct 23, 2025
ec5c01c
Merge pull request #12 from feature/add-random-names-table-t0h
dhruvsoni365 Oct 23, 2025
4a80c8d
feat(page): add yes/no radio button
Oct 24, 2025
687ccb6
Merge pull request #13 from dhruvsoni365/feature/yes-no-radio-on-new-…
dhruvsoni365 Oct 24, 2025
190fbfc
feat(form): add name and mobile number fields
Oct 24, 2025
a84db01
Merge pull request #14 from dhruvsoni365/feature/add-name-mobile-form…
dhruvsoni365 Oct 24, 2025
b428f12
feat(button): add hello greeting button
Oct 24, 2025
d85fd3f
Merge pull request #15 from feature/hello-greeting-button-pex
dhruvsoni365 Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# Contact Information Form

A responsive HTML form for collecting user's name and mobile number with real-time validation and modern styling.

## Features

### Form Fields
- **Full Name**: Text input with validation (2-50 characters, letters and spaces only)
- **Mobile Number**: Tel input with validation (10-15 digits, optional international format)

### Validation
- **Real-time validation**: Instant feedback as user types
- **Pattern matching**: Name must contain only letters and spaces
- **Mobile format**: Accepts 10-15 digit numbers with optional + prefix
- **Auto-formatting**: Mobile number gets formatted for better readability
- **Submit prevention**: Button disabled until all fields are valid

### Design Features
- **Responsive design**: Works on desktop, tablet, and mobile devices
- **Modern styling**: Gradient backgrounds, smooth animations, and hover effects
- **Accessibility**: Proper labels, focus states, and error messages
- **User feedback**: Success messages and loading states

## Files

- `contact-form.html` - Main form HTML structure
- `form-style.css` - Complete CSS styling with responsive design
- `form-script.js` - JavaScript for validation and user interactions
- `test-form.html` - Test suite for validation functions

## Usage

1. Open `contact-form.html` in a web browser
2. Fill in your full name and mobile number
3. The form will validate inputs in real-time
4. Submit button becomes active when all fields are valid
5. Click Submit to see the success message

## Testing

Open `test-form.html` to run automated tests for the validation functions. The test suite validates:

### Name Validation Tests
- ✅ Valid names with letters and spaces
- ✅ Rejects names with numbers or special characters
- ✅ Enforces length requirements (2-50 characters)

### Mobile Validation Tests
- ✅ Accepts 10-15 digit numbers
- ✅ Supports international format with + prefix
- ✅ Handles formatted numbers with spaces
- ✅ Rejects invalid formats and lengths

## Browser Compatibility

- Chrome, Firefox, Safari, Edge (modern versions)
- Mobile browsers (iOS Safari, Android Chrome)
- Responsive design works on all screen sizes

## Customization

### Styling
Edit `form-style.css` to customize:
- Colors and gradients
- Font sizes and families
- Spacing and layout
- Animation effects

### Validation Rules
Edit `form-script.js` to modify:
- Name validation pattern
- Mobile number format requirements
- Error messages
- Form behavior

### Form Submission
The current implementation shows a success message. To integrate with a backend:

```javascript
// Replace the setTimeout in form submission with actual API call
fetch('/api/submit-contact', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: name,
mobile: mobile
})
})
.then(response => response.json())
.then(data => {
// Handle success
})
.catch(error => {
// Handle error
});
```

## Security Considerations

- Client-side validation only - always validate on the server side
- Sanitize inputs before processing
- Consider rate limiting for form submissions
- Implement CSRF protection for production use

## Accessibility Features

- Semantic HTML structure
- Proper form labels and associations
- Focus indicators and keyboard navigation
- Error messages linked to form fields
- High contrast colors for readability

---

**Note**: This is a client-side only implementation. For production use, add server-side validation and proper data handling.
102 changes: 102 additions & 0 deletions USER_FORM_DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Angular User Form - Name and Email

This project demonstrates a clean, professional Angular reactive form that collects user name and email information with proper validation.

## Features

- **Reactive Forms**: Built using Angular's ReactiveFormsModule for better form control and validation
- **Form Validation**: Comprehensive validation including:
- Required field validation for both name and email
- Email format validation
- Name length validation (2-50 characters)
- Name pattern validation (letters and spaces only)
- **User Experience**:
- Real-time validation feedback
- Visual error states with helpful error messages
- Responsive design that works on all screen sizes
- Loading and success states
- Clean, modern UI with smooth animations
- **Accessibility**: Form labels, proper input types, and keyboard navigation support

## Files Structure

```
src/app/
├── user-form.component.ts # Component logic and form handling
├── user-form.component.html # Form template with validation
├── user-form.component.css # Styling and responsive design
└── app.module.ts # Module configuration with imports
```

## Component Details

### UserFormComponent

**Key Features:**
- Uses Angular FormBuilder for reactive form creation
- Implements comprehensive validation rules
- Provides helper methods for error checking and display
- Handles form submission with success feedback
- Includes form reset functionality

**Validation Rules:**
- **Name**: Required, 2-50 characters, letters and spaces only
- **Email**: Required, valid email format, max 100 characters

### Form Template

**UI Elements:**
- Clean, card-based layout
- Visual feedback for form states (valid/invalid/touched)
- Error messages with icons
- Submit and Reset buttons with appropriate states
- Development status display for debugging

### Styling

**Design Features:**
- Modern gradient background
- Card-based form layout with shadow effects
- Smooth hover and focus transitions
- Responsive design for mobile and desktop
- Error state styling with animations
- Professional color scheme

## Usage

1. **Import the component** in your app.module.ts:
```typescript
import { UserFormComponent } from './user-form.component';

@NgModule({
declarations: [
// ... other components
UserFormComponent
],
// ... rest of module config
})
```

2. **Use in templates**:
```html
<app-user-form></app-user-form>
```

## Form Behavior

- **Validation**: Real-time validation with visual feedback
- **Submission**: Form submits only when all fields are valid
- **Reset**: Users can reset the form to clear all data
- **Error Display**: Context-aware error messages guide users to correct issues

## Customization

The form can be easily customized by modifying:
- Validation rules in `user-form.component.ts`
- Styling in `user-form.component.css`
- Form layout in `user-form.component.html`

## Dependencies

- Angular (with ReactiveFormsModule)
- No external UI libraries required - uses pure CSS for styling
Loading