|
| 1 | +# ServiceNow Email Validation - onChange Script |
| 2 | + |
| 3 | +## Overview |
| 4 | +Real-time email validation script for ServiceNow catalog items that provides instant feedback as users type in email fields. |
| 5 | + |
| 6 | +## Features |
| 7 | +- Real-time validation during user input |
| 8 | +- Instant error/success messages |
| 9 | +- Dynamic message clearing based on validity |
| 10 | +- User-friendly feedback with examples |
| 11 | +- No form submission required for validation |
| 12 | + |
| 13 | +## Implementation |
| 14 | +1. Navigate to **Service Catalog > Catalog Client Scripts** |
| 15 | +2. Click **New** to create a new script |
| 16 | +3. Select your **Catalog Item** |
| 17 | +4. Set **Type** to **onChange** |
| 18 | +5. Set **Variable name** to your email field variable |
| 19 | +6. Replace `email_field_name` with actual variable name in script |
| 20 | +7. Paste the script code |
| 21 | +8. Check **Active** checkbox |
| 22 | +9. Save |
| 23 | + |
| 24 | +## Validation Rules |
| 25 | +- Required format: `user@domain.com` |
| 26 | +- Accepts: letters, numbers, dots (.), underscores (_), hyphens (-) |
| 27 | +- Minimum 2-character top-level domain |
| 28 | + |
| 29 | +## User Experience |
| 30 | +- **Invalid Input**: Red error message displayed below field |
| 31 | +- **Valid Input**: Green info message confirming valid format |
| 32 | +- **Empty Field**: No validation performed |
| 33 | +- **While Loading**: Validation skipped to prevent false errors |
| 34 | + |
| 35 | +## Benefits |
| 36 | +- Immediate feedback reduces user frustration |
| 37 | +- Prevents errors before form submission |
| 38 | +- Improves data quality |
| 39 | +- Enhances overall user experience |
0 commit comments