Author Topic: [Deprecated] An easy CCMS compatible and Ajax loaded contact form  (Read 1278 times)

Xander

  • Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 240
  • Karma: +5/-0
    • View Profile
    • CompactCMS.nl
! This topic is no longer relevant. The contact form is included by default in 1.4.0 and up.

Hi all,

I've gotten quite some requests and inquiries regarding contact forms to be used with CompactCMS. Many are interested in having an Ajax loaded form (because it just sounds cool + doesn't require reloading on submission).

Since I have multiple of those on the CCMS website and I use them for all of my projects, it doesn't feel like much hassle to explain a bit about them and give you a ready to use example which runs out of the box with CompactCMS. All there is to it are 5 simple steps (explained below), which - if you don't feel like changing the form - don't require any coding skills.

The 5 steps also included as readme.txt in the archive
1 Create new page using your CompactCMS administration
   1.1 Set the "file name" to contact
   1.2 Set the "coding?" to Yes

2 Appoint the new page a location in one of your menus
   This is just so you can call the page using your navigation. Not a required step.

3 Copy ./includes/js/mootools.js to your root directory
Note: if you decide to place mootools.js somewhere else, be sure to change the line in step 4

4 Add the line below to your template file (./index.php)
Code: [Select]
<script type="text/javascript" src="./includes/js/mootools.js" charset="utf-8"></script>
Note: if you decided to place mootools.js somewhere else, be sure to change this line (!)

5 Copy contact.php to your content directory, overwriting the empty contact.php we've created before.
5.1 Adjust the <YOUR_ADDRESS_HERE> on line 13 to your own e-mail address (or wdislikever address)

And that's it! If you now call contact.html on your site (or for an example: www.compactcms.nl/contact.html), you'll see the form which has validation and submission coding all ready & set. If you're looking for other validation rules, be sure to check out the Mootools documentation.

Depending on your comments and suggestions I might improve this basic script and perhaps include it with the default CCMS archive. Comments and suggestions are very much welcome! Note that the full source of this example is attached to this post.

Cheers,
Xander.

This script is offered AS IS. I haven't tested it extensively, and just want to indicate what is possible.
« Last Edit: December 21, 2009, 12:02:49 AM by Xander »
Don't ever hold back your suggestions. Help me either to improve CompactCMS or spread the word about it on sites such as Twitter, Digg, StumbleUpon, etc :). Thanks!

youcantryreachingme

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +1/-0
    • View Profile
Re: An easy CCMS compatible and Ajax loaded contact form
« Reply #1 on: July 30, 2009, 02:41:26 AM »
Hi Xander,

does it degrade?

Xander

  • Developer
  • Administrator
  • Full Member
  • *****
  • Posts: 240
  • Karma: +5/-0
    • View Profile
    • CompactCMS.nl
Re: An easy CCMS compatible and Ajax loaded contact form
« Reply #2 on: July 30, 2009, 01:03:00 PM »
Uhhhhmmmmmmmmm ??? Haha.. Okay, fair enough: I'm not sure what you mean by that :).
Don't ever hold back your suggestions. Help me either to improve CompactCMS or spread the word about it on sites such as Twitter, Digg, StumbleUpon, etc :). Thanks!

youcantryreachingme

  • Jr. Member
  • **
  • Posts: 58
  • Karma: +1/-0
    • View Profile
Re: An easy CCMS compatible and Ajax loaded contact form
« Reply #3 on: August 03, 2009, 06:49:49 AM »
If I don't have javascript, can I still use the form?

snooze

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: An easy CCMS compatible and Ajax loaded contact form
« Reply #4 on: August 19, 2009, 11:47:38 PM »
The attachment link is broken.