Form submission lifecycle

Summary

A trace of what happens between a user tapping Submit in the app and the server returning a result envelope plus dispatching any post-submission notifications.


End-to-end flow

User taps Submit in the app
        │
        ▼
POST /wp-admin/admin-ajax.php?action=mam_gf_submit_app_form
        │
        ▼
mam_gf_submit_app_form::handle()
        │ ├─ resolve form id from request
        │ ├─ resolve user from MAM_Current_Request
        │ ▼
do_action('mam_gf_processing_form', $form_id, $entry)
        │
        ▼
mam_gf_standard_form_handler::process_field()  per field
        │ ├─ standard handlers for text, email, etc.
        │ └─ apply_filters('mam_form_manager_process_field_type_{type}',
        │       $value, $field, $entry, ...)   ← custom field types extend here
        ▼
GF native validation runs (required, format, length)
        │
        ▼
GF native submission (entry inserted)
        │
        ▼
apply_filters('mam_for_gravity_forms_form_submitted_{form-id}',
              $entry, $form, $confirmation)
              │
              └─ apply_filters('mam_form_manager_form_submitted_{form-id}', ...) (alias)
        ▼
apply_filters('mam_for_gravity_forms_form_result_form_{form-id}',
              $result, $entry, $form)
              │
              └─ Per-form result builder shapes the envelope returned to the app
        ▼
apply_filters('mam_for_gravity_forms_form_result', $result)
              │
              └─ apply_filters('mam_for_gravity_forms_form_result_v2', $result)
        ▼
do_action('mam_form_manager_send_notifications', $entry, $form, $result)
              │
              └─ Subscribers fire do_action('mam_notification_send_message', $msg)
                 → MAM_Notification_Dispatcher routes email/SMS/push per the type registry
        ▼
JSON response to the app  { status: success | failure, message: ..., redirect: ... }

Detailed phases

1. AJAX entry

mam_gf_submit_app_form is registered for both wp_ajax_* and wp_ajax_nopriv_* (some forms — registration, contact — accept anonymous submissions).

The handler:

  • Resolves the form id from the request payload
  • Resolves the user from MAM_Current_Request (anonymous users get user id 0)
  • Decrypts and validates the nonce
  • Hands off to the form processor

2. Pre-process action

do_action( 'mam_gf_processing_form', $form_id, $entry );

Fires once per submission. Sibling plugins observe here for analytics, side effects unrelated to the form data, etc.

3. Per-field processing

Each field flows through mam_gf_standard_form_handler::process_field(). Standard field types (text, email, phone, address, choice) have built-in handlers. Custom field types extend via:

add_filter( 'mam_form_manager_process_field_type_{type}', function ( $value, $field, $entry ) {
    // your transform
    return $value;
}, 10, 3 );

⚠️ A custom field type also needs a build-time counterpart — see Custom field types.

4. Per-form submission hooks

$entry = apply_filters(
    'mam_for_gravity_forms_form_submitted_' . $form_id,
    $entry, $form, $confirmation
);

This is the most common extension point for customer-specific logic. If you need to do something specific to “the listing-submission form on this customer’s site”, hook here with the form id baked in. The aliased name mam_form_manager_form_submitted_{form-id} fires at the same point.

5. Result envelope

$result = apply_filters(
    'mam_for_gravity_forms_form_result_form_' . $form_id,
    $result, $entry, $form
);
$result = apply_filters( 'mam_for_gravity_forms_form_result', $result );
$result = apply_filters( 'mam_for_gravity_forms_form_result_v2', $result );

The result envelope shape is up to your handler — typical keys are status, message, redirect, and any per-form data the app should refresh after submission.

6. Notification dispatch

do_action( 'mam_form_manager_send_notifications', $entry, $form, $result );

This is the contract between forms-manager and notifications-manager. Subscribers fire do_action('mam_notification_send_message', $msg) for whatever needs to be emailed/SMS’d/pushed:

  • Confirmation to the submitter
  • Alert to the listing owner
  • Admin notification for moderation queues

Don’t fire mam_notification_send_message directly from your submission handler — go through mam_form_manager_send_notifications so admin overrides can intercept.

7. JSON response

The handler returns a JSON envelope to the app. The mobile client surfaces the message and follows the optional redirect.


Verification

  • A failed submission returns status: failure with a message
  • The per-form mam_for_gravity_forms_form_submitted_{form-id} filter fires once per submission (verify with a mamdebug log)
  • Every notification visible in Mobile App Manager → Notifications → Outbox Viewer corresponds to a do_action('mam_notification_send_message') triggered from a mam_form_manager_send_notifications subscriber

  • Forms manager overview
  • Custom field types
  • Form cache and invalidation
  • Hook: mam_for_gravity_forms_form_resultform{id}
  • Hook: mam_form_manager_send_notifications
  • Hook: mam_notification_send_message
  • Hook: mam_gravity_forms_after_formprocessed{id}

Metadata

Field Value
Article type Plugin Overview
Plugin slug mam-main
Applies to plugin version 2.1.11+
Category Plugin Reference
Audience PHP developer
Last verified 2026-05-02
Contents

    Need Support?

    Can’t find the answer you’re looking for? Don’t worry we’re here to help!