0

我在使用 eForm 代码段时遇到了一些问题。每次提交表单时,我都会收到内部服务器错误 500。有趣的是,报告电子邮件发送正常,只是在表单发送后无法进入“谢谢”页面。这是错误日志:

[Tue Jan 11 10:23:07 2011] [error] [client 80.175.159.225] malformed header from script. Bad header=/home/sites/annuitiesadvice.co: index.php, referer: http://www.annuitiesadvice.co.uk/

这是我的表单块:

<form method="post" action="[~[*id*]~]" name="contactform" onSubmit="javascript:populateHiddenFields(this);" id="rc_form">

(我也尝试将表单操作设置为包含表单块的静态页面,例如 about-us.html)。

这是代码段调用:

[!eForm?
&formid=`rc_form`
&to=`myemail@blabla.com, myemail2@blabla.com, myemail3@blabla.com`
&subject=`Quick Annuity Quote Submitted`
&tpl=`rc_form`
&report=`rc_form_report`
&gotoid=`55`
&eFormOnBeforeFormMerge=`ref`
&eFormOnBeforeMailSent=`form_user_ok`
!]

MODx 1.02 Apache2

知道是什么原因造成的吗?

4

1 回答 1

0

您的 eForm 调用会触发事件 eFormOnBeforeFormMerge 和 eFormOnBeforeMailSent 并且对于这些事件分别调用函数 ref 和 form_user_ok(作为一种 eForm 事件处理程序)。我假设您需要调用这些函数进行一些自定义处理(您没有指定)。如果不只是省略 eFormOnBeforeFormMerge 和 eFormOnBeforeMailSent 参数并直接消除服务器错误。

如果这些事件需要自定义处理:请仔细追溯这些调用,因为它们可能是您问题的根源。这些函数真的存在吗?它们是否包含在您的 eForm 调用之前?php格式是否正确?

请注意,通常您会收到带有一些描述性文本的 php 错误,而 eForm 事件处理程序总是最终导致服务器错误 500。因此,请务必检查语法错误和可能失败的包含以及任何其他导致 php 错误的原因。

预先提供 2 个函数,以便它们可以作为 eForm 事件处理程序调用。您可以定义一个包含它们的片段,如下所示:

// snippet name: myEformFunctions

function ref()
{
    // do your thing here
    return; // important, never return false can trigger server error
}

function form_user_ok()
{
    // do your thing here
    return; // important, never return false can trigger server error
}

然后您的 eForm 调用之前添加:

[!myEformFunctions!]
于 2011-12-08T14:50:25.283 回答