Skip to content

Troubleshooting

Michael Milette edited this page Apr 2, 2018 · 11 revisions

Here are some common issues and solutions that you might encounter the first time you try to get a contact form working in Moodle.

When you submit a form, you get an Error 404 Page (or Object) not found!

The sample code included in the documentation for the Contact Form for Moodle plugin assumes that you are submitting the form from a Moodle page. If you are submitting it from a different type of plugin like an HTML block, you may need to modify the URL in the ACTION parameter of the FORM tag so that it reflects the location of local/contact/index.php plugin. You can avoid this problem completely by using the {wwwroot} tag from the FilterCodes plugin if installed and activated. See an example on how to use the {wwwroot} tag with Contact Form.

When submitting a form, you get a blank screen, a message saying "Forbidden" or it just doesn't work.

Normally if there is anything wrong with your webform, you should see a message that says "Forbidden", not get a blank screen. Regardless, you can uncover the cause of the error by enabling Developer Debug mode in Moodle and then trying to send a message through your form again. This time you should see one or more messages appear that will tell you what's wrong with your webform.

To enable debugging, login to your site as a Moodle Administrator and navigate to Home > Site Administration > Development > Debugging. Next, set Debugging Messages to DEVELOPER: Extra Moodle debug messages for Developers and make sure the box next to "Display debug messages" is checked if you want to see the errors on your screen. Otherwise they just end up in your log file. Scroll down to the bottom of the page and click the Save changes button.

IMPORTANT NOTE: This will cause extra debugging messages to appear across your whole site for all users. If this is a live site, do this when no one is using the site. Either way, be sure to set Debugging Messages back to NONE as soon as you are done.

If there is a problem with your form, you should see some extra information which will either be helpful or that you can use to find an answer in the documentation. If not, go back to the Debugging page and check the box for Debug email sending and try again. Don't forget to go back and uncheck this box too.

Form submit error message

Moodle no-reply email address is invalid.

In order for Contact Form to work properly, you must configure the no-reply email address with a valid email address.

Moodle support email address is invalid.

In order for Contact Form to work properly, you must configure the support email address with a valid email address.

File attachments not supported.

Contact Form does not support file attachments so don't even try.

Missing submit button.

The form must contain a submit button with an id/name of "submit" however the value of the button, which is the text that appears in the button can be anything you like.

Form cannot contain more than 1024 fields.

Let's be reasonable. Do you think your users have all day to be out filling over 1024 fields in your form? By the way, 1024 includes hidden fields as well as the submit button.

Form must be submitted using POST method.

Don't even think about changing it to a GET method. It's not going to work unless you can give me a really good reason why I should support the GET method as well as POST.

Form cannot contain more than 256 KB of data.

Are you asking users to submit their homework through a Contact Form? Take a look at the Assignment activity module. Best form design practices should limits the information you require just to the information you need and they don't need to send you over 256 KB of information in an email. Who are you trying to kid? You're not going to read it anyway.

"sesskey" field is missing or contains an incorrect value.

You probably didn't include the SCRIPT tag line in the form or the hidden "sesskey" hidden field. These are some of the required HTML that is necessary in order for the form to work. Read the documentation and examine the code included in the Minimal Template Form Example. There are very specific elements that must be part of the form in order for it to work. As part of Moodle's anti-spam security.

Missing referrer. OR Unknown referrer - must come from this site.

There is an assumption going on here that people came from somewhere unlike a spambot that submits forms from nowhere. This is for your inbox protection.

Unknown sender - invalid email address or the form field name is incorrect.

We validate the "from" email address that you type into a form. Fill in the form honestly and we will let you submit it. The name of the form field email is important and required... unless you are logged-in in which case it is optional. If you can't get it to work, try pasting in one of the HTML Form Template examples in a new Moodle page.

Missing sender - invalid name or the form field name is incorrect

Yes, we validate the from name too. Fill in the form honestly and we will let you submit it. The name of the form field name is important and required... unless you are logged-in in which case it is optional. If you can't get it to work, try pasting in one of the HTML Form Template examples in a new Moodle page.

Bad sender - Email address is blacklisted.

This will show up if your email address was blacklisted. Either don't deny the email address or use a different email address. The feature has not yet been implemented at the plugin level at the time of this writing so, if you are seeing this error message, there might be something really messed up with your Moodle installation.

Bad sender - Email domain is blacklisted.

If your email address domain is unacceptable to the administrator, either because the domain of the email address has been blacklisted or because it is not included in the whitelisted domains. Either don't deny the domain or use an email address with an acceptable domain. If you are seeing this message, you have bigger problems because this feature has not yet been implemented.