Blog Sections Open

Fixing eForm onMailSent Callback Errors

eForm callback hooks are useful, but they are also easy to misconfigure. The classic failure looks like this: Fatal error: Call to undefined function 'mailSent'() Typical Setup [[eForm? &eFormOnMailSent=`mailSent` ... ]]

eForm callback hooks are useful, but they are also easy to misconfigure. The classic failure looks like this:

Fatal error: Call to undefined function 'mailSent'()

Typical Setup

[[eForm?
 &eFormOnMailSent=`mailSent`
 ...
]]
function mailSent(&$fields) {
    global $modx;
    $modx->setPlaceholder('schet', '1234');
    return true;
}

What to Check

  • whether the callback function is loaded before eForm tries to call it
  • whether quotes, parameter names, or snippet wrappers are malformed
  • whether the hook lives in the correct execution context

In callback-based setups, a working function body is not enough. The CMS also needs to know about that function at the exact moment the hook fires.

Newer post

Why AjaxSearch Can Trigger Too Many Redirects

A practical look at AjaxSearch setups that fall into redirect loops, especially when homepage or excluded-document logic is involved.

Older post

Using word-limit Safely with Ditto introtext Output

What to watch when word-limit or PHx-style truncation is applied to Ditto introtext fields that may already contain formatting.