Auto-Submit Contact Form 7 Settings #142
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #141 - Auto-submit Contact Form 7 settings when selecting FormsCRM module
Problem
Users had to manually click the "Save" button after selecting a CRM type or module in Contact Form 7's FormsCRM panel, which caused confusion and potential loss of configuration.
Solution
Implemented automatic form submission with visual feedback when users change the CRM Type or CRM Module dropdown selectors.
Changes Made
Modified Files
1.
includes/formscrm-library/class-contactform7.phpAdded Features:
Technical Changes:
Constructor (line 35):
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_autosubmit_assets' ) );CRM Type Select (lines 69-84):
<label for="fc_crm_type"><?php esc_html_e( 'CRM Type:', 'formscrm' ); ?></label>formscrm-autosubmitdata-formscrm-autosubmit="true"onchange="jQuery(this).parents('form').submit();"CRM Module Select (lines 130-140):
<label for="fc_crm_module"><?php esc_html_e( 'CRM Module:', 'formscrm' ); ?></label>formscrm-autosubmitdata-formscrm-autosubmit="true"onchange="jQuery(this).parents('form').submit();"New Method
enqueue_autosubmit_assets()(lines 332-357):$hookparameter)wp_enqueue_style()wp_enqueue_script()2.
includes/assets/formscrm-admin.css(Modified)Admin styles file now includes CF7 auto-submit styles:
.formscrm-saving-indicatorelement.formscrm-submittingstate3.
includes/assets/js/cf7-autosubmit.js(New File)Dedicated JavaScript file containing:
4. Documentation
Created comprehensive documentation:
docs/contact-form-7-autosubmit.md- Technical implementation detailsdocs/PR-141-summary.md- This summary5. Changelog
Updated
readme.txtwith new version 4.2.2 changes:User Experience Improvements
Before:
After:
Benefits
✅ Improved UX: Clear feedback that configuration is being saved
✅ Fewer clicks: No need to manually save after dropdown selection
✅ Better compatibility: Vanilla JavaScript works without jQuery dependency
✅ Prevention of errors: Disabling select prevents accidental multiple submissions
✅ Accessibility: Added proper labels to form elements
✅ Maintainability: Clean, well-documented code
✅ WordPress Standards: Properly enqueued assets following best practices
Testing
Manual Testing Checklist:
Browser Compatibility:
Works on all modern browsers supporting:
querySelectorandquerySelectorAlladdEventListenerclosest()methodBackward Compatibility
✅ No breaking changes
✅ Existing configurations remain intact
✅ Graceful degradation if JavaScript is disabled
✅ No database schema changes
✅ No changes to data storage or retrieval logic
Code Quality
read_lints)Files Changed
includes/formscrm-library/class-contactform7.php(modified)includes/assets/formscrm-admin.css(modified - added CF7 styles)includes/assets/js/cf7-autosubmit.js(new)readme.txt(updated changelog)docs/contact-form-7-autosubmit.md(new)docs/PR-141-summary.md(new)Version
Prepared for version 4.2.2
Note: Main plugin file (
formscrm.php) version numbers not updated yet - waiting for release manager approval.Related Issues
Screenshots
N/A - Visual feedback visible during interaction only
Additional Notes
Future Enhancements (Optional):
Deployment Notes: