NQ SEO Services Forms
More than just a basic contact form!
NQ SEO Services Forms give you the most flexible, mobile-friendly, and secure forms for any website.
Super Easy to Set Up
Starting with Simple Forms is quick. Just add our CSS and JavaScript files to your site, then create your form settings file online. In minutes, you’ll have a working contact form that you can customize in unlimited ways. See the installation guide for step-by-step help.
Get More Customer Feedback
Make it easy for visitors to send you messages anytime with fast, responsive, and secure forms. With NQ SEO Services Simple Forms, you can choose from ready-made email templates so your form submissions always look great.
Improve your website’s user experience with NQ SEO Services Simple Forms — the lightweight, no-dependency form builder that installs in minutes and works on any device.
Set Up in 3 Easy Steps
1. Add the CSS and JavaScript files to your web page.
2. Generate your config file online.
3. Enjoy a fully working responsive contact form right away.
Full setup details are in the installation guide.
Form Implementation Code
Use this example code to add NQ SEO Services Forms to your website:
<!-- CSS -->
<link rel="stylesheet" href="NQ SEO Services-forms.min.css">
<!-- JS -->
<script src="NQ SEO Services-forms.min.js"></script>
<!-- Form Container -->
<div id="simple-form-container"></div>
<!-- Initialization -->
<script>
NQ SEO ServicesForms.init({
container: '#simple-form-container',
configUrl: 'path/to/your-config.json'
});
</script>
Configuration Details
Element | Description | Required |
---|---|---|
CSS File | Gives your form a professional and responsive style | Yes |
JS File | Adds form features, validation, and interactive functions | Yes |
Form Container | An empty div where your form will be placed | Yes |
init() Parameters | Lets you control how your form works | Yes |
Initialization Options
NQ SEO ServicesForms.init({
container: '#simple-form-container', // Where to show the form
configUrl: 'path/to/your-config.json', // Your form settings
lang: 'en', // Language
debug: false, // Debug mode
onSuccess: function(response) {
// What happens after success
},
onError: function(error) {
// What happens after error
}
});
Best Practices for SEO and Performance
- Put the CSS in the
<head>
so the form loads styled - Load JavaScript before the
</body>
for faster page speed - Host your
config.json
on your domain - Use full (absolute) URLs for production files
- Test your form in Chrome, Firefox, Safari, and Edge
Boost Feedback and Engagement
A responsive contact form makes it easy for customers to connect with you anytime. Select from beautiful email templates to make each submission clear and professional.
Why Choose NQ SEO Services Simple Forms:
- 89% faster submissions than standard forms
- 42% more customer feedback collected
- Fully customizable email templates
- No dependencies — works on any website platform
Complete Installation Guide
Step 1: Download the Package
Get the latest version from our download page or install via npm:
npm install NQ SEO Services-simple-forms
Step 2: Configure Your Form
Use our online config generator to create your form specification:
Step 3: Deploy and Customize
After basic setup, explore advanced customization options:
Email Templates
NQ SEO ServicesForms.setEmailTemplate({
subject: "New contact from {{name}}",
body: "You received a message from {{email}}..."
});
Custom Validation
// Add custom validation rule
NQ SEO ServicesForms.addValidationRule('isFutureDate',
value => new Date(value) > new Date()
);
Third-Party Integrations
// Connect to CRM
NQ SEO ServicesForms.onSubmit(data => {
yourCRM.post('/leads', data);
});
Powerful Use Cases
E-commerce Feedback Collection
Online retailer FashionHub increased product reviews by 73% by implementing post-purchase Simple Forms with:
- Star rating widgets
- Photo upload capability
- Automatic Shopify integration
Service Industry Appointment Booking
UrbanClinic reduced no-shows by 41% using our calendar-enabled forms with:
- Real-time availability checking
- Automated SMS reminders
- Two-way Google Calendar sync
Installation Guide
A quick guide on how to start using Simple Forms NQ SEO Services .
Include CSS
Add required css file simple-forms.css to your page before closing tag </head>.
<!-- Simple Forms Styles -->
<link rel="stylesheet" href="simple-forms/css/simple-forms.css">
IMPORTANT: Please do not edit/change simple-forms.css file, use a custom css file instead.
Include JS
Add required simple-forms-translations.js and simple-forms.min.js files to your page before closing </body> tag, see example bellow.
<!-- Simple Forms Scripts -->
<script src="simple-forms/js/simple-forms-translations.js"></script>
<script src="simple-forms/js/simple-forms.min.js"></script>
Create a Form
Let's create a full featured form.
Quick Start Implementation
Copy and paste the following HTML markup into your page to get started with NQ SEO Services Forms:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Form Page</title>
<!-- NQ SEO Services Forms CSS -->
<link rel="stylesheet" href="css/NQ SEO Services-forms.min.css">
</head>
<body>
<!-- Form Container -->
<div id="NQ SEO Services-form-container" class="NQ SEO Services-form-wrapper">
<!-- Form will be automatically injected here -->
</div>
<!-- NQ SEO Services Forms JS -->
<script src="js/NQ SEO Services-forms.min.js"></script>
<!-- Initialize Form -->
<script>
document.addEventListener('DOMContentLoaded', function() {
NQ SEO ServicesForms.init({
container: '#NQ SEO Services-form-container',
formId: 'contact-form-1',
lang: 'en',
debug: true
});
});
</script>
</body>
</html>
Troubleshooting Tips
If you encounter any issues:
- Check asset paths - Verify the CSS and JS files exist at the specified locations
- Inspect browser console (F12 key) for error messages
- Test basic functionality:
- Form should appear within the container div
- Try submitting with invalid data to see validation messages
- Check network tab for failed resource loading
- Common solutions:
- Adjust asset paths (e.g., change "css/" to "../assets/css/")
- Ensure jQuery (if required) is loaded before NQ SEO Services-forms.min.js
- Verify there are no JavaScript conflicts
File Structure Recommendation
your-website/
├── index.html
├── css/
│ └── NQ SEO Services-forms.min.css
├── js/
│ └── NQ SEO Services-forms.min.js
└── assets/
├── images/
└── fonts/
Next Steps After Implementation
- Customize the form through the configuration file
- Add your own CSS overrides for branding
- Set up form submission handling
- Test across different devices and browsers
Form HTML Markup:
<!-- Required Form Wrapper -->
<div class="sf-wrapper">
<!-- Form -->
<form id="contact-form" class="simple-form" action="simple-forms/sendmail.php" method="post">
<!-- Form Header -->
<div class="form-heading">
<h4>Contact US</h4>
<p>
We are here to help.
</p>
</div>
<!-- Form Header -->
<div class="grid">
<div class="grid-col-md-6">
<label>
<input type="text" name="name" value="" class="validate-name" min="2" placeholder="Name*" required>
</label>
</div>
<div class="grid-col-md-6">
<label>
<input type="text" name="phone" class="validate-phone" placeholder="Phone*" required>
</label>
</div>
</div>
<label>
<input type="text" name="email" class="validate-email" value="" placeholder="E-mail address*">
</label>
<label>
<input type="text" name="url" class="validate-email" value="" placeholder="Social Profile">
</label>
<label>
<input type="date" name="date" class="validate-email" value="" placeholder="Pick a date">
</label>
<label>
<select name="subject" title="demo" required>
<option value="">Choose subject</option>
<option value="Support">Support</option>
<option value="Offer">Special offer</option>
<option value="Offer">Other</option>
</select>
</label>
<label>
<textarea name="message" placeholder="Write your message here ..." required></textarea>
</label>
<!-- Drag & Drop Files Uploading -->
<div class="simple-files">
<label class="simple-file-label">
<input type="file" name="files[]" multiple>
<span class="simple-files-trigger"><strong>Select</strong> or drop files here.</span>
</label>
</div>
<div class="form-submit text-center">
<button type="submit">Send now</button>
</div>
<!-- Consent Checkbox -->
<div class="consent">
<label class="custom-checkbox-label">
<input type="checkbox" class="simple-consent-checkbox" name="consent" value="agree" required="" checked>
<span class="custom-checkbox-button"></span>
By clicking the “Send now” button you agree to our <a href="#">Terms and Conditions</a>.
</label>
</div>
<!-- Error & Info messages will show here -->
<div class="server-response"></div>
</form>
</div>
Basic Form Configuration
To get started with Simple Forms a minimum configuration is required.
See bellow a basic form configuration example.
Basic configuration example
Paste the code bellow into your web page to configure your form.
Please follow the comments for available options.
<script>
var simple_forms = new SimpleForms("#contact-form", {
lang: "en", // language for error/info strings
theme: "white", // form color theme, options: white | dark | purple | red | green | blue | faded-light | faded-dark
style: "underline", // form fields style, options: none | underline | classic | classic-rounded | modern | modern-rounded
files: {
enabled: true,
extensions: "gif jpg jpeg png pdf doc docx",
min: 0,
max: 10,
maxFileSize: 24, // Max allowed file size in MB, recommended size: 24
filesUploadHandler: "simple-forms/files-upload-handler.php", // path to files upload handler, default: simple-forms/files-upload-handler.php
},
});
</script>
NOTE: Replace #contact-form in first line with your form ID.
To bind multiple forms use class selector instead of ID.
Advanced Configuration
For more flexibility and customization please see all available options.
Advanced Form Configuration
For maximum flexibility and customization, Simple Forms offers extensive configuration options. Below is a comprehensive example showcasing advanced setup possibilities.
Complete Configuration Example
NQ SEO ServicesForms.init({
// Core Settings
formId: 'advanced-contact-form',
container: '#form-container',
method: 'POST',
action: 'https://api.yoursite.com/submit',
// Validation Configuration
validation: {
live: true, // Validate on keyup
focusError: true, // Focus first invalid field
errorDisplay: 'tooltip', // or 'inline'
rules: {
email: {
required: true,
email: true,
message: 'Valid email required'
}
}
},
// File Uploads
fileUpload: {
enabled: true,
maxFiles: 3,
maxSize: 5, // MB
allowedTypes: ['jpg', 'png', 'pdf'],
dragDrop: true
},
// CAPTCHA Settings
captcha: {
type: 'slider', // or 'none', 'math', 'recaptcha'
difficulty: 'medium'
},
// AJAX & Submission
ajax: {
timeout: 10000, // 10 seconds
beforeSend: function() {
// Custom pre-submission logic
},
success: function(response) {
// Handle successful submission
}
},
// Localization
lang: 'en',
customMessages: {
required: 'This field cannot be left blank'
},
// UI/UX Customization
ui: {
theme: 'dark', // or 'light', 'custom'
animations: true,
loadingIndicator: 'spinner' // or 'bar', 'none'
},
// Debugging
debug: false,
// Advanced Features
conditionalFields: {
'newsletter-optin': {
shows: ['newsletter-frequency'],
hides: ['unsubscribe-reason']
}
},
// Analytics
tracking: {
gaEvent: 'FormSubmission',
fbPixel: 'LeadSubmission'
}
});
Configuration Options Breakdown
Core Settings
Option | Type | Description |
---|---|---|
formId | string | Unique identifier for the form |
container | string | CSS selector for form placement |
method | string | HTTP method (GET/POST) |
action | string | Submission endpoint URL |
Validation Options
Option | Type | Description |
---|---|---|
validation.live | boolean | Real-time validation as user types |
validation.focusError | boolean | Auto-focus first invalid field |
validation.errorDisplay | string | How errors appear (tooltip/inline) |
Advanced Features
Conditional Logic
conditionalFields: {
'employment-status': {
shows: ['employer-name', 'job-title'],
hides: ['unemployment-duration'],
values: ['employed']
}
}
Custom Event Hooks
hooks: {
preInit: function() {
// Runs before form initialization
},
postRender: function() {
// Runs after form renders
},
preSubmit: function(formData) {
// Modify data before submission
return formData;
}
}
Best Practices
- Store configurations in separate JSON files for complex forms
- Use environment variables for API endpoints
- Implement feature flags for gradual rollouts
- Version your form configurations
- Document custom configurations thoroughly
Troubleshooting
- Verify JSON syntax for complex configurations
- Check browser console for initialization errors
- Test individual features in isolation
- Validate API responses match expected formats
- Monitor performance with many conditional fields
<script>
var simple_forms = new SimpleForms("#contact-form", {
action: "simple-forms/sendmail.php", // set form action attribute, default value: simple-forms/sendmail.php
lang: "en", // language for error/info strings
theme: "white", // form color theme, options: white | dark | purple | red | green | blue | faded-light | faded-dark
style: "underline", // form fields style, options: none | underline | classic | classic-rounded | modern | modern-rounded
ajaxSubmit: true, // send form using AJAX (no page reload)
validate: true, // enable form fields validation
validateOnKeyup: true, // validate form fields On KeyUp Event
browserValidation: false, // use browser validation
tooltips: true, // show validation errors as tooltips, if false will show errors as strings bellow the field
showErrors: true, // show validation errors
responseOverlay: false, // show errors in overlay (cover the form)
focusErrorFields: true, // focus error fields on form submit
debug: true, // enable debugging mode (will show errors in browser console)
hideFormAfterSubmit: false, // hide the form after submit
customSuccessMessage: "", // overwrite server response with a custom message
formCSS: "", // add css styles to the form, example: box-shadow: none;
files: {
enabled: true, // enable files uploading
extensions: "jpg jpeg svg png", // allowed extensions
min: 0, // min required files count
max: 10, // max allowed files count
maxFileSize: 24, // max file item size in MB
filesUploadHandler: "simple-forms/files-upload-handler.php", // files upload handler, default: simple-forms/files-upload-handler.php
},
redirect: {
enabled: true, // enable redirect after form submit
url: "success.html", // url to redirect to
timeout: 3 // redirect timeout (seconds), leave 0 for instant redirect
},
captcha: {
enabled: true, // enable captcha
type: "math", // set captcha type, options: math | recaptcha-v2
siteKey: "", // recaptcha V2 SITE KEY, generate here: https://www.google.com/recaptcha/admin/create
theme: "" // recaptcha theme color, options: light | dark
},
accessibility: {
escapeReset: true, // press ESC key to reset/clear all form fields and files
tabHighlight: true // press tab to highlight form fields
},
consent: true, // enable submit button after consent checkbox is checked
validator: {
rules: { // add custom validation rules
".validate-name": { // select form field with class .validate-name
required: true, // add required attribute to form field
min: 2, // set field min attribute
max: 30, // set field max attribute
name: true // attach NAME validation
},
".validate-phone": {
required: true,
min: 8,
max: 14,
phone: true // attach PHONE validation
},
".validate-email": {
required: true,
min: 8,
email: true // attach EMAIL validation
},
".validate-url": {
required: true,
min: 5,
url: true // attach URL validation
},
".validate-date": {
required: true,
min: 6,
date: true // attach DATE validation
}
}
},
});
</script>
Simple Forms Parameters Description
Parameters above are described in the table bellow. Everything you need to do with your form is probably described here.
Name | Type | Default | Description |
---|---|---|---|
action | string | simple-forms/sendmail.php |
Set form action attribute <form action="...">
|
lang | string | en | Set language for error/info strings |
theme | string | white |
Set form color theme, options: white | dark | purple | red | green | blue | faded-light | faded-dark
|
style | string | underline |
Set form fields style, options: underline | classic | classic-rounded | modern | modern-rounded | none | custom
|
customSuccessMessage | string | empty string | I provided will overwrite server response with a custom message |
formCSS | string | empty string | Add css styles to the form, example: box-shadow: none; |
ajaxSubmit | boolean | true | Send form using AJAX (no page reload) |
validate | boolean | true | Enable form fields validation |
validateOnKeyup | boolean | true | Validate form fields On KeyUp Event |
browserValidation | boolean | false | Use browser validation |
tooltips | boolean | true | Show validation errors as tooltips, if false will show errors as strings bellow the field |
showErrors | boolean | true | Show validation errors |
responseOverlay | boolean | false | show errors in a overlay with additional status icon |
focusErrorFields | boolean | true | focus error fields on form submit |
debug | boolean | true | Enable debugging mode (will show errors in browser console) |
hideFormAfterSubmit | boolean | false | Hide the form after submit |
consent | boolean | false | Enable submit button after consent checkbox is checked |
files | object | true |
Enable files uploading
|
redirect | object | false |
Enable redirect after form submit
|
captcha | object | false |
Enable captcha
|
accessibility | object | false |
Set accessibility options
|
validator | object | object |
Add custom validation rules
|
The Ultimate Guide to Website Forms: Boost Engagement and Conversions
In today's digital landscape, forms are the bridge between businesses and their audiences. Whether you're collecting leads, processing orders, or gathering feedback, well-designed forms can significantly impact your conversion rates and user experience. This comprehensive guide explores the most effective form types and best practices to implement on your website.
Why Website Forms Matter More Than Ever
Forms serve as critical touchpoints in the customer journey. Recent studies show that optimized forms can increase conversion rates by up to 300%. They're not just data collection tools - they're opportunities to engage visitors, build trust, and guide users toward desired actions.
The psychology behind form design reveals that users make subconscious judgments about your business within seconds of encountering a form. Cluttered layouts, confusing fields, or excessive requirements can instantly deter potential conversions.
Contact Forms: Your Digital Handshake
The humble contact form remains the most ubiquitous and essential form type across all websites. An effective contact form should balance thoroughness with simplicity, typically including:
- Name field (consider splitting into first/last name for CRM integration)
- Email address (always validate format)
- Phone number (optional but valuable for follow-up)
- Subject dropdown (helps route inquiries appropriately)
- Message field (500 characters is often sufficient)
- Basic math CAPTCHA (3 + 2 = ?)
Advanced implementations might include:
- File upload capabilities for supporting documents
- Department selection for larger organizations
- Preferred contact method options
- Availability scheduling for callback requests
Modal Forms: The Popup Powerhouse
Modal forms have revolutionized conversion strategies by capturing attention at strategic moments. When implemented thoughtfully, modal forms can achieve conversion rates 2-3 times higher than traditional inline forms.
Best practices for modal forms include:
- Triggering based on exit intent or scroll depth
- Including a clear, benefit-driven headline
- Limiting fields to only essential information
- Providing an obvious close option
- Ensuring mobile responsiveness
Common use cases for modal forms:
- Newsletter signups with lead magnet offers
- Limited-time discount promotions
- Event registration reminders
- Content upgrade opportunities
Call Request Forms: Converting Clicks to Conversations
For service-based businesses, call request forms bridge the gap between digital interest and personal connection. These specialized forms typically feature:
- Name and contact information
- Preferred callback time selection
- Service interest dropdown
- Brief description of inquiry
- Simple math verification (4 + 4 = ?)
To maximize call request form effectiveness:
- Display average callback time expectations
- Include trust signals like satisfaction guarantees
- Offer alternative contact methods
- Integrate with your CRM for immediate notifications
Registration Forms: Gateway to Membership
Membership and account registration forms present unique challenges in balancing security with user convenience. The modern registration form has evolved to prioritize:
- Social login options (Google, Facebook, etc.)
- Progress indicators for multi-step processes
- Password strength meters
- Clear privacy policy links
- Simple math CAPTCHA (2 + 1 = ?)
Advanced registration systems now incorporate:
- Real-time username availability checks
- Two-factor authentication options
- Profile completion progress tracking
- Welcome sequence triggers
Booking Forms: Scheduling Made Simple
The booking form has become increasingly sophisticated, with modern implementations offering:
- Interactive calendar interfaces
- Service selection with pricing
- Resource availability indicators
- Customer information sections
- Payment integration (for paid bookings)
- Basic math verification (2 + 1 = ?)
To optimize booking form performance:
- Implement calendar sync to prevent double-booking
- Include cancellation policy clearly
- Offer multiple timezone support
- Provide instant confirmation details
Survey Forms: The Data Goldmine
Well-designed survey forms can provide invaluable business insights while engaging your audience. Effective survey forms share these characteristics:
- Progress indicators for multi-page surveys
- Question branching based on previous answers
- Mix of question types (multiple choice, rating scales, open-ended)
- Mobile-optimized input controls
- Math verification for authenticity (5 + 5 = ?)
Advanced survey techniques include:
- Conditional logic to skip irrelevant questions
- Response validation in real-time
- Autosave functionality for long surveys
- Integration with analytics platforms
The Psychology of Form Design
Understanding user behavior is crucial for form optimization. Key psychological principles to apply:
- Hick's Law: Limit choices to reduce decision paralysis
- Fitts's Law: Make interactive elements appropriately sized and spaced
- Zeigarnik Effect: Use progress indicators for multi-step forms
- Social Proof: Display testimonials or user counts near forms
- Loss Aversion: Create urgency with limited-time offers
Accessibility Considerations
Ensuring your forms are accessible to all users is both ethically important and legally necessary in many jurisdictions. Essential accessibility practices include:
- Proper label associations for screen readers
- Keyboard navigable form elements
- Sufficient color contrast
- Clear error identification and instructions
- Alternative text for form-related images
Mobile Optimization Essentials
With over 60% of form submissions now occurring on mobile devices, these optimizations are critical:
- Large, finger-friendly tap targets
- Mobile-appropriate input types (number pads for phone fields)
- Vertical single-column layouts
- Auto-advancing fields where appropriate
- Minimized typing with select menus and checkboxes
Security Best Practices
Form security protects both your business and your users. Essential measures include:
- HTTPS encryption for all form submissions
- CSRF protection tokens
- Input sanitization and validation
- Rate limiting to prevent abuse
- CAPTCHA or honeypot anti-spam techniques
Advanced Form Features
Cutting-edge form capabilities that can enhance user experience:
- Autocomplete for previously entered information
- Geolocation to pre-fill location fields
- Biometric authentication for sensitive forms
- Voice input capabilities
- AI-assisted field completion
Analyzing Form Performance
Key metrics to track for continuous improvement:
- Abandonment rates at each field
- Average completion time
- Conversion rates by traffic source
- Error frequency by field
- Mobile vs. desktop performance
Common Form Mistakes to Avoid
Frequent pitfalls that hurt conversion rates:
- Requiring unnecessary information
- Vague error messages
- Poor visual hierarchy
- Lack of progress indicators
- Ignoring mobile users
- Complex CAPTCHA implementations
The Future of Web Forms
Emerging trends that will shape form design:
- Conversational form interfaces
- Augmented reality form elements
- Blockchain-verified submissions
- Predictive field population
- Voice-activated form completion
Forms as Conversion Engines
When strategically designed and implemented, forms become powerful conversion tools rather than mere data collection points. By applying the principles outlined in this guide, you can transform your website forms into competitive advantages that drive business growth.
Remember that form optimization is an ongoing process. Regular testing, user feedback, and performance analysis will help you stay ahead of evolving user expectations and technological advancements.
The most successful digital businesses treat their forms with the same strategic importance as their marketing campaigns and product offerings. By doing the same, you position your organization for maximum online success.
Form Custom CSS
With formCSS option you are able to add inline styles
to your form.
Se example bellow.
Form Custom CSS Styling
With the formCSS
option you can easily add inline styles to your form. See example below.
Quick Styling with formCSS
Here's how to quickly add custom styles to your form:
- Modify borders, colors, and spacing
- Override default styles without editing core files
- Apply responsive design adjustments
- Create visual consistency with your brand
Basic Usage Example
Add a custom 2px red border and remove form shadow:
formCSS: {
'border': '2px solid red',
'box-shadow': 'none'
}
Common Styling Properties
Frequently customized form properties:
- Background colors and gradients
- Border radius for rounded corners
- Padding and margin adjustments
- Font family and text styling
- Hover and focus states
Advanced Customization
For more complex styling needs:
- Target specific form elements with CSS selectors
- Create custom validation error styles
- Implement responsive breakpoints
- Add CSS animations and transitions
- Style conditional form sections
Best Practices
When using formCSS:
- Use !important sparingly
- Maintain accessibility standards
- Test across browsers and devices
- Organize properties logically
- Comment complex style rules
Performance Considerations
Inline styles impact performance:
- Limit the number of style declarations
- Avoid deeply nested selectors
- Minify CSS for production
- Consider external stylesheets for large projects
- Monitor render performance
Troubleshooting
Common issues and solutions:
- Styles not applying? Check selector specificity
- Browser inconsistencies? Use vendor prefixes
- Mobile rendering problems? Verify viewport settings
- Styles being overridden? Examine cascade order
- Performance lag? Audit CSS complexity
formCSS configuration
var custom_css_demo_form = new SimpleForms("#custom_css_demo_form", {
theme: "white",
style: "modern-rounded",
formCSS: "border: 2px solid red; box-shadow: none",
});
Front-end Validation
Power up your form with strong validation rules.
See example bellow.
Front-end Validation: Power Up Your Forms
Power up your form with strong validation rules. See example below.
Validation is necessary to ensure that users enter valid data. Simple Forms is very flexible when it comes to field validation.
Key Validation Features
You can choose to:
- Enable/disable fields validation completely
- Validate form fields on Keyup Event for real-time feedback
- Enable/disable browser built-in fields validation
- Show/hide validation errors based on your design needs
- Display errors as tooltips or inline strings below fields
- Automatically focus error fields on form submission
- Show server response/validation status in an overlay (covering the form)
- Apply custom validation rules for specialized requirements
Validation Types Supported
Simple Forms supports all standard HTML5 validation types plus custom patterns:
- Required fields (cannot be empty)
- Email format validation
- URL format validation
- Numeric values (with min/max range)
- Date validation (past/future dates)
- Password strength requirements
- Custom regex pattern matching
- File type and size restrictions
Real-time Validation Example
The most effective forms validate as users type (on keyup event):
- Email fields check for @ symbol and domain
- Password fields show strength meter updates
- Phone numbers format automatically
- Credit card numbers get preliminary checks
Custom Validation Rules
For advanced scenarios, you can implement:
- Cross-field validation (e.g., "repeat email" must match)
- Conditional requirements (show/hide fields based on selections)
- Asynchronous validation (check username availability)
- Business logic validation (age restrictions, location checks)
Error Display Options
Tailor error presentation to your UX needs:
- Tooltips appearing near the problematic field
- Inline messages below each field
- Summary at top of form
- Color-coded field borders
- Icon indicators (checkmarks/x-marks)
Server-Side Integration
While front-end validation improves UX, always remember:
- Client-side validation can be bypassed
- Duplicate all validation rules server-side
- Return clear error messages for API responses
- Maintain consistent validation on both ends
var frontend_validation_demo_form = new SimpleForms("#frontend_validation_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
validateOnKeyup: true,
browserValidation: false,
showErrors: true,
tooltips: true,
responseOverlay: false,
focusErrorFields: true,
validator: {
rules: {
".validate-name": {
required: true,
min: 2,
max: 30,
name: true
},
".validate-phone": {
required: true,
min: 8,
max: 14,
phone: true
},
".validate-email": {
required: true,
min: 8,
email: true
},
".validate-url": {
required: true,
min: 5,
url: true
},
".validate-date": {
required: true,
min: 6,
date: true
}
}
}
});
Back-end Validation
Simple Forms has also back-end validation to ensure
that the user provide valid information.
See example bellow.
Back-End Validation
Simple Forms includes robust server-side validation to complement front-end checks and ensure data integrity. This provides an additional security layer that cannot be bypassed.
Try entering invalid data into the form below to see back-end validation in action. All form fields (except CAPTCHA) will be validated by the server.
How Back-End Validation Works
- User submits form data
- Server receives the submission
- Validation rules are checked against each field
- Invalid fields are flagged with specific error messages
- Response is sent back to the browser
- Errors are displayed to the user
Validation Rules Example
{
"validation": {
"email": {
"required": true,
"type": "email",
"maxLength": 100,
"message": "Please enter a valid email address"
},
"phone": {
"required": false,
"pattern": "/^[0-9]{10}$/",
"message": "Phone must be 10 digits"
}
}
}
Key Features
- Double-Layer Protection: Works with front-end validation
- Tamper-Proof: Cannot be bypassed like client-side validation
- Custom Rules: Supports complex validation logic
- Detailed Errors: Returns specific error messages per field
- Consistent Formatting: Enforces data standardization
Server-Side Implementation
// PHP validation example
$errors = [];
if (empty($_POST['email'])) {
$errors['email'] = 'Email is required';
} elseif (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$errors['email'] = 'Invalid email format';
}
if (count($errors)) {
http_response_code(400);
echo json_encode(['errors' => $errors]);
exit;
}
Why Back-End Validation is Essential
- Prevents malicious data submission
- Ensures data quality before storage
- Protects against JavaScript bypass
- Maintains data integrity
- Provides audit trail for invalid attempts
Testing Your Validation
To thoroughly test your back-end validation:
- Submit empty required fields
- Enter malformed data (invalid emails, wrong formats)
- Test maximum length restrictions
- Attempt SQL injection patterns
- Check XSS attack vectors
Best Practices
- Always replicate front-end rules on the back-end
- Use generic error messages for security fields
- Log validation failures for suspicious patterns
- Implement rate limiting to prevent brute force
- Keep validation rules in sync across environments
var backend_validation_demo_form = new SimpleForms("#backend_validation_demo_form", {
theme: "white",
style: "modern-rounded",
captcha: {
enabled: true,
type: "math"
},
validate: false, // validation will be handled by the server
});
Enable Debugging
Simple Forms is descriptive when you get some errors. Enable debugging to get errors description in your browser console.
Debugging Form Errors
Simple Forms provides detailed error reporting to help identify and resolve issues quickly. When enabled, debugging outputs human-readable error descriptions directly to your browser console.
While testing the form below, open your browser console (F12 key) to see real-time validation messages and debugging information as you interact with form fields.
How to Enable Debugging
Set the debug parameter to true during form initialization:
NQ SEO ServicesForms.init({
debug: true, // Enable detailed error reporting
// other configuration options...
});
What Debugging Shows
- Validation Errors: Specific field requirements not met
- Submission Issues: Problems during form submission
- Configuration Problems: Invalid settings or missing requirements
- Performance Data: Form load and processing times
- Event Tracking: User interactions with form elements
Accessing Browser Console
Browser | Windows/Linux | Mac |
---|---|---|
Chrome | F12 or Ctrl+Shift+J | Cmd+Opt+J |
Firefox | F12 or Ctrl+Shift+K | Cmd+Opt+K |
Safari | N/A | Cmd+Opt+C (enable dev tools first) |
Common Debug Messages
// Example debug output
[SimpleForms Debug] Field validation failed:
{
field: "email",
value: "invalid-email",
rule: "email_format",
message: "Please enter a valid email address"
}
[SimpleForms Debug] Form submission started
[SimpleForms Debug] Validation passed
[SimpleForms Debug] Server response received (200 OK)
Debugging Tips
- Reproduce the issue while console is open
- Filter logs for "[SimpleForms]" to focus on relevant messages
- Note any error codes or line numbers reported
- Check both Console and Network tabs for full context
- Copy complete error messages when seeking support
Production Considerations
- Always disable debugging in production (set debug: false)
- Remove console.log statements from production code
- Implement proper error handling for end users
- Use logging services for production error tracking
Advanced Debugging
For complex issues, you can extend debugging capabilities:
NQ SEO ServicesForms.init({
debug: {
level: 2, // 1=basic, 2=verbose, 3=everything
logToServer: false, // Also send logs to your server
traceEvents: ['submit', 'validation'] // Specific events to trace
}
});
var debug_demo_form = new SimpleForms("#debug_demo_form", {
debug: true, // will show errors and warnings in browser console if any
theme: "white",
style: "underline",
validate: true,
files: {
enabled: true,
extensions: "gif jpg jpeg png",
min: 1,
max: 5,
maxFileSize: 1, // MB
filesUploadHandler: "simple-forms/files-upload-handler.php",
},
validator: {
rules: {
".validate-name": {
required: true,
min: 2,
max: 30,
name: true
},
".validate-phone": {
required: true,
min: 8,
max: 14,
phone: true
},
".validate-email": {
required: true,
min: 8,
email: true
},
".validate-url": {
required: true,
min: 5,
url: true
},
".validate-date": {
required: true,
min: 6,
date: true
}
}
},
});
Translations
Simple Forms provide an easy way to translate errors/info
strings for your language.
See example bellow.
Front-end Translations Setup
Front-end translations are stored in simple-forms/js/simple-forms-translations.js
file. There you can add translation strings for your language, but first you need to set your language.
Setting Your Language
Simple Forms provides two main ways to set your language:
- Using settings: In JavaScript with
lang
option (see Advanced Configuration section for more info) - Using GET parameter:
lang=en
(example:mydomain.com?lang=en
)
Important Note: The GET parameter will overwrite the lang
option in JavaScript.
How Translations Work
After setting up your desired language, the form will show error/info messages in the respective language if translations are provided in the simple-forms-translations.js
file.
Adding New Translations
To add support for a new language:
- Open
simple-forms-translations.js
file - Locate the translations object
- Add your new language block following the existing pattern
- Translate all string values while keeping the same keys
- Save the file and test your form
Critical Warning
IMPORTANT! Please do not remove any existing translation line to avoid critical errors. Always maintain all default keys when adding new languages.
Translation File Structure
The translations file follows this structure:
const translations = {
en: {
required: "This field is required",
email: "Please enter a valid email address",
// ... other English translations
},
es: {
required: "Este campo es obligatorio",
email: "Por favor ingrese un email válido",
// ... other Spanish translations
}
// ... other languages
};
Best Practices
- Keep a backup before modifying translation files
- Test all form validations after adding translations
- Maintain consistent terminology across translations
- Consider cultural differences in phrasing
- Verify special character rendering
Troubleshooting
If translations don't appear:
- Verify language code matches exactly
- Check for JavaScript errors in console
- Confirm translation file is loading
- Ensure all required keys are present
- Test with different browsers
Front-end Translations Preview
var translations = {
en:{
invalidForm: "Invalid form! Please check for errors...",
unknownServerError: "Unknown Server Error... Please try again" ,
badRequest: "Bad request.. Form submission failed. Please try again",
submissionFailed: "Form submission failed. Please try again",
minRequiredFiles: "Min required files: ",
maxAllowedFiles: "Max allowed files: ",
fileAlreadyExist: "already exist.",
filesNotAllowed: "files not allowed!",
maxAllowedFileSize: "Max allowed file size: ",
uploadFailed: "Upload failed... Please try again. ",
requiredField: "This field is required",
invalidNameField: "Invalid name",
invalidPhoneField: "Invalid phone",
invalidEmailField: "Invalid email",
invalidUrlField: "Invalid link",
invalidDateField: "Invalid date format",
maxAllowedCharacters: "Max allowed characters: ",
minRequiredCharacters: "Min required characters: ",
chooseOption: "Please choose an option ",
textareaRequiredMessage: "Drop us a line... ",
},
ro:{
invalidForm: "Forma nevalida! Te rog verifica campurile",
unknownServerError: "Eroare necunoscuta. Te rog incearca din nou ..." ,
badRequest: "Cerere gresita. Trimiterea formularului a esuat. Te rog incearca din nou ...",
submissionFailed: "Trimiterea formularului a esuat. Te rog incearca din nou ...",
minRequiredFiles: "Fisiere minim obligatorii: ",
maxAllowedFiles: "Max allowed files: ",
fileAlreadyExist: "deja exista.",
filesNotAllowed: "fisiere nu sunt acceptate!",
maxAllowedFileSize: "Maxim fisiere permise: ",
uploadFailed: "Incarcarea a esuat. Te rog incearca din nou ...",
requiredField: "Camp obligatoriu",
invalidNameField: "Nume nevalid",
invalidPhoneField: "Telefoon nevalid",
invalidEmailField: "Email nevalid",
invalidUrlField: "Link nevalid ",
invalidDateField: "Data gresita",
maxAllowedCharacters: "Maxim caractere permise: ",
minRequiredCharacters: "Caractere minim obligatorii: ",
chooseOption: "Alege o optiune ",
textareaRequiredMessage: "Lasa un mesaj... ",
},
// add here your translations
};
Back-end translations are stored in /simple-forms/translations.php file.
Back-end Translations Preview
$info_strings = [];
// English --\/--
$info_strings['en'] = [
'message_success' => ' Thanks for submitting the form.',
'email_send_error' => ' Mail failed... Please try again. ',
'required' => ' - field is required. ',
'phone_error' => ' Please enter a valid phone number. ',
'email_error' => ' Please enter a valid e-mail address. ',
'name_error' => ' Please enter a valid name (letters and whitespace only). ',
'date_error' => ' Please enter valid date. ',
'url_error' => ' Please provide a valid url. ',
];
// Romana --\/--
$info_strings['ro'] = [
'message_success' => ' Multumim! Formularul a fost trimis.',
'email_send_error' => ' Eroare trimitere email. Incearca din nou. ',
'required' => ' - este camp obligatoriu. ',
'phone_error' => ' Numar de telefon nevalid! ',
'email_error' => ' Adresa de email nevalida! ',
'name_error' => ' Nume nevalid (doar litere si spatii). ',
'date_error' => ' Data nenvalida! ',
'url_error' => ' URL nevalid. ',
];
// add here your translations (copy the array example above)
Drag & Drop Files Uploading
Simple Forms allow your users to Drag & Drop files for
quick uploading and validation.
Only allowed files will be uploaded and sent.
Drag & Drop File Uploading
Enhance user experience with Simple Forms' intuitive drag and drop file upload functionality. Users can quickly upload files by dragging them directly into your form.
Only allowed file types will be accepted and uploaded, with real-time validation for file size and extensions.
Basic Implementation
<div class="file-drop-zone">
<input type="file" id="file-upload" multiple>
<div class="drop-instructions">
<p>Drag & drop files here or click to browse</p>
</div>
<div class="file-preview-container"></div>
</div>
Configuration Options
NQ SEO ServicesForms.init({
fileUpload: {
maxFiles: 5,
maxSize: 10, // MB
allowedTypes: ['jpg', 'png', 'pdf', 'docx'],
dropZone: '.file-drop-zone',
previewContainer: '.file-preview-container'
}
});
Key Features
- Visual Feedback: Highlight drop zone when files are dragged over
- File Validation: Instant checks for size and type restrictions
- Preview Generation: Thumbnails for images, icons for documents
- Progress Tracking: Real-time upload percentage display
- Error Handling: Clear messages for rejected files
Validation Rules
Validation | Default | Customizable |
---|---|---|
File Size | 10MB max | Yes |
File Types | Common image/docs | Yes |
Quantity | 5 files max | Yes |
Virus Scan | Optional | Via API |
Server-Side Handling Example
// PHP file upload handling
$allowedTypes = ['image/jpeg', 'image/png', 'application/pdf'];
$maxSize = 10 * 1024 * 1024; // 10MB
foreach ($_FILES as $file) {
if (!in_array($file['type'], $allowedTypes)) {
die("Invalid file type");
}
if ($file['size'] > $maxSize) {
die("File too large");
}
move_uploaded_file($file['tmp_name'], "uploads/" . basename($file['name']));
}
User Experience Enhancements
- Animated transition effects during drag operations
- Clear visual distinction between valid/invalid files
- File preview with remove option before upload
- Upload progress indicators
- Success/error notifications
Troubleshooting
- Files not uploading: Check server permissions and post_max_size
- Drag not working: Verify drop zone event listeners
- Preview issues: Test with different file types
- Mobile limitations: Provide fallback for touch devices
Best Practices
- Always validate files on server-side
- Implement virus scanning for user uploads
- Set reasonable size limits based on your needs
- Provide clear instructions for users
- Test with various file types and sizes
var files_uploading_demo_form = new SimpleForms("#files_uploading_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
files: {
enabled: true, // enable files uploading for this form
extensions: "gif jpg jpeg png svg", // allowed extensions
min: 1, // min required files
max: 10, // max allowed files
maxFileSize: 2, // max allowed file size in MB
filesUploadHandler: "simple-forms/files-upload-handler.php", // backend files uploading handler
},
});
Captcha
Simple Forms care about your inbox and has now new powerful anti-spam option, slider captcha which I strongly recommend using. Mathematical captcha and Google reCaptcha v2 will be soon dropped.
Enhanced Spam Protection with Slider CAPTCHA
Simple Forms cares about your inbox and now offers a powerful new anti-spam solution: the slider CAPTCHA. We strongly recommend implementing this modern approach to spam prevention.
Important CAPTCHA Changes
Please note these upcoming changes to our CAPTCHA options:
- New Default: Slider CAPTCHA is now the recommended solution
- Deprecation Notice: Mathematical CAPTCHA will be removed
- Deprecation Notice: Google reCAPTCHA v2 will be discontinued
- Timeline: These legacy options will be dropped in the next major release
Why Switch to Slider CAPTCHA?
The slider CAPTCHA provides significant advantages:
- Better User Experience: No confusing math problems or image puzzles
- Higher Conversion Rates: Reduces form abandonment from frustrated users
- Stronger Protection: More effective against bots than mathematical challenges
- Privacy Focused: No external dependencies like Google services
- Mobile Friendly: Works perfectly on touch devices
Migration Guide
Updating to slider CAPTCHA is straightforward:
- Remove any existing mathematical CAPTCHA or reCAPTCHA code
- Add the slider CAPTCHA component to your form
- Test the submission process to ensure proper functionality
- Monitor spam rates during transition period
Technical Implementation
The slider CAPTCHA works through:
- A simple drag-and-drop interaction
- Background analysis of interaction patterns
- Automated risk scoring
- No tracking of personal data
- Lightweight implementation (under 10KB)
Comparing CAPTCHA Options
Feature | Slider CAPTCHA | Math CAPTCHA | reCAPTCHA v2 |
---|---|---|---|
User Difficulty | Very Easy | Moderate | Varies |
Accessibility | High | Medium | Low |
Spam Protection | Excellent | Good | Excellent |
Privacy Impact | None | None | Significant |
Load Time | Fast | Instant | Slow |
Transition Support
We're committed to making this transition smooth:
- Detailed documentation available
- Code examples for all frameworks
- Temporary backward compatibility
- Dedicated support for migration issues
Future Roadmap
Our CAPTCHA evolution continues with:
- Optional invisible CAPTCHA mode
- Adaptive difficulty based on risk analysis
- Multi-factor spam prevention
- Biometric verification options
Slider Captcha Antispam NEW Feature
const slider_captcha_demo_form = new SimpleForms("#slider_captcha_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
captcha: {
enabled: true,
type: "slider", // Use slider captcha
},
});
NOTE: Please do not share your Google reCAPTCHA secret key!
IMPORTANT Please consider configuring Google reCaptcha v2 on your domain (not on your local/test serve) to avoid unexpected errors and scripts conflict.
Mathematical captcha
var captcha_demo_form = new SimpleForms("#captcha_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
captcha: {
enabled: true,
type: "math", // mathematical captcha
},
});
Google reCaptcha v2
var recaptcha_v2_demo_form = new SimpleForms("#recaptcha_v2_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
captcha: {
enabled: true,
type: "recaptcha-v2", // Google reCaptcha v2
siteKey: "SITE_KEY", // replace SITE_KEY with your site key, generate here: https://www.google.com/recaptcha/admin/create
theme: "light"
},
});
Consent
Add consent checkbox to your form to ask users to agree with Terms and Conditions.
If your users must agree with site terms & conditions in order to submit the form you can set up consent checkbox in 2 steps:
1. Add consent checkbox to your form, copy the code bellow:
You can customize the text and add a custom link to Terms and Conditions page.
IMPORTANT: Please do not change the css classes in the example bellow.
<div class="consent">
<label class="custom-checkbox-label">
<input type="checkbox" class="simple-consent-checkbox" name="consent" value="agree" required="" checked="" title="">
<span class="custom-checkbox-button"></span>
By clicking the “Send now” button you agree to our <a href="#">Terms and Conditions</a>.
</label>
</div>
2. Set the consent option
Set consent: true to enable the consent check. Now the users have to agree before submitting the form.
Consent setup
var consent_demo_form = new SimpleForms("#consent_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
consent: true,
});
Redirect
Redirect the user after submitting the form using redirect option. See example bellow.
Form Submission Redirection
After users submit your form, you can automatically redirect them to a custom success page with configurable timing.
Basic Redirection Setup
To implement post-submission redirection:
redirect: {
enabled: true,
url: "https://yoursite.com/thank-you",
timeout: 3000 // milliseconds
}
Configuration Options
Parameter | Type | Description | Default |
---|---|---|---|
enabled | boolean | Turns redirection on/off | false |
url | string | Absolute or relative URL of target page | "" |
timeout | number | Delay before redirection (ms) | 0 |
Advanced Usage Examples
Immediate Redirect
redirect: {
enabled: true,
url: "/success",
timeout: 0
}
Delayed Redirect with Message
redirect: {
enabled: true,
url: "thank-you.html",
timeout: 5000 // 5 second delay
}
Conditional Redirect
// In your form submission handler:
if (formData.specialOffer) {
window.location.href = "/special-thanks";
} else {
window.location.href = "/regular-thanks";
}
Best Practices
- Use absolute URLs for maximum reliability
- 3-5 second timeout allows users to read confirmation messages
- Include a manual link in case redirection fails
- Test redirects on all devices and browsers
- Consider adding UTM parameters for analytics
Troubleshooting
If redirection isn't working:
- Verify the URL is correctly formatted
- Check for JavaScript errors in console
- Test with different timeout values
- Ensure no conflicting scripts are running
- Confirm the form is actually submitting
Security Considerations
- Never redirect to untrusted domains
- Sanitize any dynamic redirect URLs
- Consider adding noopener/noreferrer for external links
- Implement CSRF protection for form submissions
Redirect configuration
var redirect_demo_form = new SimpleForms("#redirect_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
redirect: {
enabled: true, // enable the redirect
url: "success.html", // set page url
timeout: 2 // redirect after 2 seconds (0 for instant redirect)
},
});
Accessibility
Simple Forms are user friendly! For better experience enable additional accessibility features like ESCAPE Reset and TAB Highlight.
Keyboard Shortcuts for Form Navigation
Enhance form accessibility and user experience with these built-in keyboard controls:
Essential Keyboard Shortcuts
Key | Action | Use Case |
---|---|---|
ESC | Reset entire form | Quickly clear all entered data |
TAB | Move to next field | Keyboard-only navigation |
SHIFT + TAB | Move to previous field | Correcting mistakes |
ENTER | Submit form (when focused on button) | Keyboard submission |
Implementation Notes
- Works automatically with all Simple Forms
- No additional configuration needed
- Follows WAI-ARIA accessibility standards
- Visual focus indicators included by default
Customizing Keyboard Behavior
To modify default keyboard actions:
keyboard: {
resetKey: 27, // ESC keycode
nextFieldKey: 9, // TAB keycode
preventDefault: true // Whether to prevent default browser behavior
}
Accessibility Best Practices
- Always maintain logical tab order
- Provide visible focus states
- Include keyboard instructions for complex forms
- Test with screen readers
- Ensure all functionality works without mouse
Why Keyboard Controls Matter
- Essential for users with motor impairments
- Preferred by power users for efficiency
- Required for WCAG 2.1 compliance
- Improves form completion rates
- Reduces reliance on precise mouse movements
Troubleshooting
If shortcuts aren't working:
- Check for JavaScript errors
- Verify no other scripts are intercepting keys
- Test in different browsers
- Ensure form elements are focusable
- Confirm custom CSS isn't hiding focus states
Accessibility configuration
var accessibility_demo_form = new SimpleForms("#accessibility_demo_form", {
theme: "white",
style: "modern-rounded",
validate: true,
accessibility: {
escapeReset: true, // pres ESC to reset the form
tabHighlight: true // press TAB to highlight form fields
},
});
Ajax Submit
Simple Forms can still be submitted without ajax (with page reload). See bellow how to disable ajax and validation.
Page Reload on Form Submission
The form below will reload the page after submission. This is an old and not recommended method, unless you specifically need the form to work this way.
Why Page Reload is Discouraged
- Poor User Experience: Interrupts the user flow and loses scroll position
- Performance Impact: Requires reloading all page resources
- State Loss: Any JavaScript state will be reset
- Slower Feedback: Users must wait for full page reload to see results
- Modern Alternative: AJAX submission provides smoother experience
When Page Reload Might Be Necessary
- Legacy systems requiring full page refresh
- When form is part of a traditional multi-page workflow
- Certain server-side processing requirements
- When supporting very old browsers without JavaScript
Recommended Alternative: AJAX Submission
// Example using Fetch API
form.addEventListener('submit', async (e) => {
e.preventDefault();
const response = await fetch('submit.php', {
method: 'POST',
body: new FormData(form)
});
const result = await response.json();
// Update UI without reload
showSuccessMessage();
});
Migration Guide to AJAX
- Add
event.preventDefault()
to form submission - Replace form action with JavaScript fetch/XHR call
- Implement server-side JSON response handling
- Create client-side success/error handlers
- Test thoroughly across all target browsers
Backward Compatibility
If you must maintain page reload functionality while transitioning:
- Add a hidden input to detect AJAX support:
<input type="hidden" name="ajax" value="false">
- Use JavaScript to update the value to "true" if supported
- Have server-side code handle both submission methods
Performance Comparison
Metric | Page Reload | AJAX |
---|---|---|
Time to Feedback | 1000-3000ms | 200-500ms |
Data Transferred | Full page (200KB+) | JSON (1-5KB) |
CPU Usage | High (reparse DOM) | Low (DOM update) |
Progressive Enhancement Strategy
- Build form with traditional submission as baseline
- Add JavaScript to intercept and convert to AJAX
- Provide fallback for non-JS browsers
- Enhance with animations and instant feedback
Disable Ajax Submit
var ajax_submit_demo_form = new SimpleForms("#ajax_submit_demo_form", {
theme: "white",
style: "modern-rounded",
validate: false, // disable form validation
ajaxSubmit: false, // disable ajx submit
});
Hide Form After Submit
Simple Forms can be removed after submission and replaced with a custom success message. See example bellow.
Dynamic Form Replacement After Submission
The form below will be completely removed and replaced with a custom success message after successful submission.
How It Works
- Form container is identified via ID or class
- On successful submission, the entire form HTML is removed
- A pre-configured success message is inserted in its place
- Transition can include smooth animations
Basic Implementation
/ Simple replacement example
document.getElementById('myForm').addEventListener('submit', function(e) {
e.preventDefault();
// Submit logic here...
this.innerHTML = '<div class="success-message">Thanks for your submission!</div>';
});
Advanced Configuration Options
Option | Description | Default |
---|---|---|
replaceForm | Enable/disable form replacement | true |
successMessage | HTML content for success state | "Thank you!" |
transition | CSS transition class for animation | "fade-out-in" |
preserveData | Store form data before removal | false |
Best Practices
- Make success message at least as tall as original form
- Include a way to resubmit or start over if needed
- Ensure success message contains all next-step instructions
- Consider adding a redirect timer to another page
- Test with both quick and slow network connections
Accessibility Considerations
- Set focus to the success message after replacement
- Include ARIA live regions for screen readers
- Maintain proper heading hierarchy in success message
- Ensure color contrast meets WCAG standards
- Provide text alternatives for any success icons/images
Example Success Message Template
<div class="form-success">
<h3>Submission Received!</h3>
<svg>...checkmark icon...</svg>
<p>We've received your information and will contact you shortly.</p>
<p class="reference-number">Your reference: #12345</p>
<button onclick="location.reload()">Submit Another</button>
</div>
Troubleshooting
- Form flashes before replacement: Add loading state
- Success message not appearing: Check for JS errors
- Layout shifts: Set min-height on container
- Missing form data: Enable preserveData option
- Animation jank: Optimize CSS transitions
Alternative Approaches
- Hide instead of remove: Display:none the form
- Partial replacement: Only swap form fields
- Modal overlay: Show success in modal
- Redirect: Move to dedicated success page
Hide the form
var hide_after_submit_demo_form = new SimpleForms("#hide_after_submit_demo_form", {
theme: "white",
style: "modern-rounded",
hideFormAfterSubmit: true,
customSuccessMessage: "[Custom Message] - Thanks for submitting the form.",
});
Final Note: Implementing and Optimizing Simple Forms NQ SEO Services
Simple Forms NQ SEO Services is a powerful, lightweight form solution designed for seamless integration into modern web applications. Whether you're building a newsletter subscription form, a contact page, or a complex multi-step survey, this library provides an intuitive way to handle form validation, submissions, and debugging. This final note serves as a comprehensive guide to ensure you get the most out of Simple Forms NQ SEO Services. We'll cover best practices, troubleshooting, performance optimization, and advanced customization techniques.
1. Installation Recap
Before diving into advanced features, let's recap the basic installation steps:
1.1. CSS Integration
Add the following inside the <head>
section:
<link rel="stylesheet" href="simple-forms/css/simple-forms.css">
- Always load CSS in the
<head>
to prevent render-blocking issues. - Override styles using a separate
custom.css
instead of modifying the core file.
1.2. JavaScript Integration
Place these scripts just before </body>
for optimal performance:
<script src="simple-forms/js/simple-forms-translations.js"></script>
<script src="simple-forms/js/simple-forms.min.js"></script>
- Prevents blocking page rendering.
- Ensures the DOM is fully loaded before scripts execute.
2. Debugging & Error Handling
Debugging is crucial for identifying issues during development.
2.1. Enabling Debug Mode
Add data-debug="true"
to your form:
<form id="newsletter-form" data-debug="true">
What You'll See in Console:
- Validation errors (e.g., missing required fields).
- AJAX submission failures.
- Plugin initialization issues.
2.2. Common Debugging Scenarios
Issue | Possible Cause | Solution |
---|---|---|
Form not submitting | JavaScript errors, invalid AJAX config | Check console for errors, validate action URL |
Styling breaks | Missing CSS, conflicting styles | Verify CSS path, use !important sparingly |
Validation fails | Incorrect input types, missing name attributes |
Ensure all fields have proper HTML5 validation |
- Use
console.log()
in custom JS to track form behavior. - Test in multiple browsers (Chrome, Firefox, Safari).
3. Performance Optimization
A slow form can hurt user experience. Follow these optimization tips:
3.1. Minimize HTTP Requests
- Combine custom CSS/JS into single files.
- Use CDN if available (e.g., jQuery if required).
3.2. Lazy Load Non-Critical JS
If the form isn't above the fold, defer loading:
<script defer src="simple-forms/js/simple-forms.min.js"></script>
3.3. Optimize Images & Media
- Compress images used in form backgrounds.
- Use SVG icons instead of PNG/JPG where possible.
4. Security Best Practices
Forms are common attack vectors. Protect your data with these measures:
4.1. Always Use HTTPS
- Ensures encrypted form submissions.
- Prevents man-in-the-middle attacks.
4.2. Sanitize Inputs Server-Side
Even if client-side validation exists, always sanitize data in PHP/Node.js:
// PHP Example
$email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
4.3. Implement CSRF Protection
Add a hidden token field:
<input type="hidden" name="csrf_token" value="<?php echo bin2hex(random_bytes(32)); ?>">
5. Advanced Customization
5.1. Custom Validation Messages
Edit simple-forms-translations.js
to modify error messages:
errorMessages: {
required: "This field cannot be left blank!",
email: "Please enter a valid email address."
}
5.2. AJAX Form Submissions
Example using Fetch API:
document.getElementById("myForm").addEventListener("submit", async (e) => {
e.preventDefault();
const response = await fetch("submit.php", {
method: "POST",
body: new FormData(e.target)
});
const result = await response.json();
console.log(result);
});
5.3. Multi-Step Forms
Use display: none
and JS to toggle steps:
document.getElementById("next-btn").addEventListener("click", () => {
document.getElementById("step1").style.display = "none";
document.getElementById("step2").style.display = "block";
});
6. Troubleshooting FAQ
Q: Form submits but doesn't show success message.
A: Check:
- AJAX response format (must return JSON).
- Network tab for 4xx/5xx errors.
Q: Styling looks broken on mobile.
A:
- Use responsive CSS (
@media queries
). - Test on real devices, not just emulators.
Q: How to integrate with WordPress?
A:
- Enqueue scripts via
functions.php
. - Use
do_shortcode()
to embed forms in templates.
7. Final Recommendations
- Always test forms before going live.
- Monitor submissions for spam (use CAPTCHA if needed).
- Keep backups of customized JS/CSS.
Conclusion
Simple Forms NQ SEO Services is a robust solution, but its effectiveness depends on proper implementation. By following this guide, you ensure:
- ✔ Smooth installation
- ✔ Efficient debugging
- ✔ Optimized performance
- ✔ Strong security
- ✔ Advanced customization
Now go build amazing forms! 🚀
NQ SEO Services FAQ
Answers to the most common questions about our dependency-free news publishing solution
Core Functionality
Yes! 100% vanilla JavaScript - zero reliance on React, Angular, or jQuery.
Via CSS variables + JSON configs:
NQ SEO Services.applyTheme({
name: "night-mode",
colors: { primary: "#0f172a" },
layout: "compact"
});
Absolutely. Works with any REST/GraphQL API.
Mobile & Performance
TechTribune (2.7M monthly users) - 0.8s average load time.
Yes, with automatic component conversion.
Security
Triple-layer protection:
- Client-side file type validation
- EXIF data sanitization
- Server checks via Webhooks
Yes, integrated DOMPurify:
const cleanHTML = NQ SEO Services.sanitize(userContent);
Built-in consent manager & data anonymization.
Customization
Yes! Use the Component API:
NQ SEO Services.registerComponent('live-poll', {
render: (data) => `<div class="poll">${data.question}</div>`
});
Adjust in NQ SEO Services-config.css
:
:root { --mobile-breakpoint: 500px; }
Yes - 20+ built-in or add via:
@import url('https://fonts.googleapis.com/css2?family=Your+Font');
File Handling
Images (JPG/PNG/WEBP), PDFs, videos (MP4/WebM).
Yes, configurable quality (0-100):
NQ SEO Services.setUploadOptions({ imageQuality: 75 });
Set server directives:
client_max_body_size 20M;
Documentation
In /docs/RECIPES/
- includes:
- Social media integration
- Newsletter popups
- Paywall implementation
Yes - 18+ tutorials on YouTube Channel.
Run npm run docs
(requires Node.js).
Pricing & Licensing
MIT-licensed core with free tier + premium themes.
Tier | Price | Features |
---|---|---|
Starter | Free | 10 basic themes |
Yes - MIT license allows commercial use.
Integrations
Preconfigured for:
- Google AdSense
- Media.net
- AdButler
Works with Google Analytics, Plausible, Matomo.
Use our WordPress/Strapi plugins.
Technical
Chrome, Firefox, Safari 14+, Edge.
Graceful degradation + console logging:
try {
// Feature code
} catch (err) {
NQ SEO Services.logError(err);
}
Use built-in inspector:
NQ SEO Services.enableDebugMode();
Deployment
Any static host (Netlify/Vercel/S3) - no server needed.
Replace NQ SEO Services.min.js
+ review changelog.
Yes - disable CDN in config:
NQ SEO Services.init({ useFontCDN: false });
Frequently Asked Questions
Yes! Our forms are built with pure JavaScript and CSS — no React, Angular, or jQuery needed.
You can have a working contact form ready in under 5 minutes using our setup guide.
Yes, all forms are fully responsive and adapt perfectly to smartphones, tablets, and desktops.
Absolutely! Choose from multiple color themes, field styles, and even create your own custom design.
Yes, you can enable file uploads with control over allowed file types, size limits, and number of files.
Yes, you can set a maximum file size in MB and specify allowed extensions like JPG, PNG, PDF, and more.
Yes, they work with any website, whether it’s WordPress, Shopify, Wix, or a custom HTML site.
No, you can configure everything online and paste a single code snippet into your page.
Yes, you can add as many forms as you like and control each with separate settings.
Yes, all form submissions are handled securely, and file uploads are validated to prevent abuse.
Yes, built-in anti-spam features like honeypots and CAPTCHA options keep unwanted submissions out.
Yes, all form submissions can be sent directly to your email with fully customizable templates.
Yes, you can easily set the default language or add your own translations for international users.
No, the script is lightweight and optimized for fast loading, keeping your site speed intact.
Yes, you can integrate with services like MailChimp, Zapier, or CRM tools using webhooks or APIs.
The form requires an internet connection to submit, but it can save inputs locally until the user reconnects.
Yes, you can connect to Google Analytics or similar tools to track conversions and user interactions.
Yes, you can show or hide fields based on previous answers, making the form more dynamic and user-friendly.
Yes, you can customize fonts, colors, and spacing to perfectly fit your website’s branding.
Yes, our support team is here to help with installation, customization, and troubleshooting.