As part of my website plan, I wanted to include a contact form where a user could upload a URL or an image to a form, add a message and submit this to the database for admins to review and choose whether or not to include it in the site. Admins would be notified via email after the form had been submitted. As this is not a module allowed in ExpressionEngine Core, I decided to use a third party contact form module so that I could still use this feature.

Using a form I created in a client website (http://www.craigslade.com/contact.php) I modified it accordingly and applied it to the contact template. I styled it to sit it in the middle of the page and for it to resize on smaller browser sizes.

contact form - design

Where you would normally have the <form> tag pair, the plugin (freeform) I was using replaced this code with {exp:freeform:form form_name=”contact” return=”site/index.php” required=”name|email|comment” notify_admin=”no”}.

As you can see, I have set the required fields. This is the older (3.0) version of the software. For some reason, the latest version would not allow me to add or update field names, so I was unable to use the file_upload field in my form. I did however have URL so I could just be linked to an image if necessary. The most disappointing aspect was that I had to omit a parameter called ‘notify’. Notify involved the email being sent to notify the admin of a submission.

I worked alongside Shelley incorporating the code word for word from her working form, but no matter how many times I did it, it would not work. My guess is that my hosting provider doesn’t like third party email clients. Either that or EE Core literally prevents emails being sent from it’s templates when involved in any {exp} tag pair. Regardless, I had to do without this feature. The good thing is that it still provides an entry to the database, and as every field is required any submission will include all information needed.  Admins can still acquire this information, but they will have to do so manually. I am highly confident that on another hosting plan with another provider, I could easily configure the form to work. I have had a lot of trouble (and still am) regarding contact forms on GoDaddy, so I hope they don’t lose me a mark!

contact form - code

Advertisements