SPForm FAQ

If you don't find an answer here, ask for help in the appropriate section of the MODX Forums. If they might have a bearing on your problem, be sure to include your browser version, MODX version, hosting service, Apache version, PHP version, and MySQL version.


Click on a question to expand the answer

Show All      Hide All

Everything appears to work but no mail arrives.

The most common problem with SPForm is that it uses php mail() by default. Many servers have this disabled. If this is the case, you should see an error message suggesting that you use SMTP. You can ust the MODx SMTP System Settings to send all mail from the site by SMTP. You can also use the SMTP settings in the snippet properties grid to turn on this option, but --

Important: don't use both!!!.

The System Settings are the recommended method. The only reason to use the snippet properties is if you have different forms and want to use a different SMTP server for each of them.

You can use any SMTP account, even at a different server, to send with SPForm. Be sure to set all the SMTP options correctly.

If you continue to have this problem, take a close look at the &recipientArray setting in the snippet properties. It should be a comma-separated list of titles and email addresses. Like this:

Webmaster :webmaster@yourdomain.com,Sales :Sales@yourdomain.com, Support :support@yourdomain.com

I changed an option, but nothing has changed.

Remember that when you change a snippet property setting, you have to *save* the snippet or the change will be lost.

Clear the MODx site cache (Manage | Clear cache), then clear your browser cache (usually on the Tools menu -- something like Clear Private Data or Delete Browsing History).

After submitting the page, I get a white screen with an unauthorized referer error message.

Make sure that the &formprocAllowedRefers setting includes all domains that your form can be reached through (e.g. yourdomain.com,www.yourdomain.com, etc.). If you turn on the &spfDebug option, you should see the actual referer near the top of the output. Make sure that referer is listed in formprocAllowedReferers.

For example, if you see this for the referer:

    https://mydomain.com/modx/index.php?id=0

You should have mydomain.com in your referers list.

The spform page looks unstyled and the validation doesn't work.

Be sure that the Contact page and the Response page have been assigned a template. If they have no template (or a minimal template), they will display but with no CSS and no javascript. Be sure to save the page after assigning a template. Clear the site cache after assigning a template.

The CSS file for SPForm is at:

    assets/components/spform/css/spform.css


If you want to change it, copy it to another file and use the &spfCssPath property to point to it.

I have the hidden field turned on, but I can see it in the form.

Be sure that the Contact page and the Response page have been assigned a template. If they have no template, they will display but with no CSS which will allow the hidden field to be visible. Make sure, also that the path to the CSS file is correct.

Clear the site cache after assigning a template.

I keep getting error messages when submitting the form.

The error message should tell you which SPForm option is causing the trouble. Turn it off in the properties grid or with a property in the snippet tag.

I have the takeMeBack option on, but no link appears on the response page.

Some servers will delete the referer variable. For those servers, the Take Me Back option won't work.

My users often send me lots of links in their messages and they always get an error.

Change the &maxLinks setting in the snippet properties grid or a property in the snippet tag to allow more links in a message.

The box for entering a message is too big or too small.

Change the &spTextRows and &spTextCols settings to make it the size you want.

I'm still having trouble.

Set the &warnAll, &spfDebug, and &adviseAll settings to 1. This will give a warning for all errors and also email the errors to the &errorsTo address in addition to printing the debugging information on the form. Be sure to turn all three off after you find the problem.

If you're still having trouble, post your problem in the SPForm section at the MODx forums

When I get mail from the contact form, I see a warning that the message may not have been sent by the user. how can I fix that?

Add this in the SPForm snippet tag:
&useemailsender=`1`
That will tell SPForm to set the email in the emailsender System Setting in the message's "from" address. Be sure the System Setting is set and that it is an address from your domain. You may have to delete the core/cache files before this takes effect.

 

My book, MODX: The Official Guide - Digital Edition is now available here. The paper version of the book is available from Amazon.

If you have the book and would like to download the code, you can find it here.

If you have the book and would like to see the updates and corrections page, you can find it here.

MODX: The Official Guide is 772 pages long and goes far beyond this web site in explaining beginning and advanced MODX techniques. It includes detailed information on:

  • Installing MODX
  • How MODX Works
  • Working with MODX resources and Elements
  • Using Git with MODX
  • Using common MODX add-on components like SPForm, Login, getResources, and FormIt
  • MODX security Permissions
  • Customizing the MODX Manager
  • Using Form Customization
  • Creating Transport Packages
  • MODX and xPDO object methods
  • MODX System Events
  • Using PHP with MODX

Go here for more information about the book.

Thank you for visiting BobsGuides.com

  —  Bob Ray