18. Submission Processing Pipeline | Form Forge - Build Forms with AI in Seconds
Download Log in

18. Submission Processing Pipeline

Developer Guide

The complete lifecycle of a form submission from POST to response.

Pipeline Stages

  1. Nonce Verificationcheck_ajax_referer( 'formforge_nonce', 'nonce' )
  2. Anti-Spam Checks — honeypot, time check, token validation, reCAPTCHA
  3. Form Loading — form is loaded from the database by form_id
  4. Field Sanitization — each field value is sanitized based on type via FORMFORGE_Field_Types::sanitize()
  5. Field Validation — required checks, format validation, custom regex
  6. File Upload Processing — files are validated (MIME, size) and moved to uploads directory
  7. Conditional Logic Evaluation — hidden fields are excluded from required validation
  8. Submission Storage — data is JSON-encoded and inserted into wp_formforge_submissions; if the insert fails, the AJAX response is an error and no integrations or submit analytics are fired
  9. Integration Dispatch — email, webhooks, Mailchimp, HubSpot, Google Sheets, etc.
  10. Post/User Creation — if enabled, WordPress posts or users are created
  11. Analytics Trackingsubmit event recorded in wp_formforge_analytics only after a submission row exists
  12. Response — JSON success/error response sent to the frontend

Hooking into the Pipeline

php
// Before save (stage between 2 and 8)
add_action( 'formforge_before_submit', function( $form_id, $data, $form ) {
    // Custom validation, data modification, external checks
}, 10, 3 );

// After save (stage after 11)
add_action( 'formforge_after_submit', function( $submission_id, $form_id, $data ) {
    // CRM pushes, logging, external notifications
}, 10, 3 );

Error Handling Strategy

Integration errors (Mailchimp, Google Sheets, HubSpot) are logged but never block the submission. The user always sees a success response if the core submission succeeds. Mailchimp and HubSpot write a short rolling diagnostic tail to the formforge_integration_log option so support can distinguish skipped submissions from remote API failures without exposing the error to visitors.

Forge AI Assistant Online

Hi! I'm the Form Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs