开发者

MODx eForm Internal Server Error

开发者 https://www.devze.com 2023-02-03 09:29 出处:网络
I\'m having a few problems with the eForm snippet. Every time a form is submitted I\'m getting an Internal Server Error 500. Funny thing is, the report email is sent fine, just can\'t get to a \"thank

I'm having a few problems with the eForm snippet. Every time a form is submitted I'm getting an Internal Server Error 500. Funny thing is, the report email is sent fine, just can't get to a "thank you" page after the form is sent. Here is the error log:

[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/

Here's my form chunk:

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

(I've also tried just setting the form action to a static page where the form chun开发者_Python百科k is included, such as about-us.html).

Here's the snippet call:

[!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

Any idea what could cause this?


Your eForm call fires the events eFormOnBeforeFormMerge and eFormOnBeforeMailSent and for those events calls the functions ref and form_user_ok respectively (as sort of eForm event handlers). I assume you need to call these functioner for some custom processing (you did not specify). If not just omit the eFormOnBeforeFormMerge and eFormOnBeforeMailSent parameters and eliminate the server error directly.

If custom processing is required for these events: Trace these calls back carefully because they are likely the root of your issue. Do these functions actually exist and are they included before your eForm call? Is the php well formed?

Note that usually where normally you'd get a php error with some descriptive text, an eForm event handler always ends up causing server error 500. So make sure to check for syntax errors and possibly failed includes and any other causes for php errors.

To provide the 2 functions upfront so that they can be called as an eForm event handler. You could define a snippet having both of them like so:

// 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
}

then before your eForm call add:

[!myEformFunctions!]
0

精彩评论

暂无评论...
验证码 换一张
取 消