WARNING: concrete5 5.6 and earlier are end-of-life. Sales from the marketplace have now ended. Click here to learn more about this transition.

Ajax Form

NOTE about Concrete5.6 and up: I've moved this functionality over to github: https://github.com/jordanlev/c5_ajax_form/ and will no longer be maintaining this addon. It works fine in 5.6, but the github code works better, and I can't guarantee this addon will continue to work in 5.7, 5.8, etc.


This is a set of custom templates which add ajax functionality to the built-in form block, so that pages do not reload when forms are submitted.

To ajax-ify a form, simply add it as you normally would (or edit the page if it's already there), then click on the block and choose "Custom Template" from the popup menu, then select "Ajax Default Layout" from the dropdown menu and click "Update", then exit edit mode and publish your changes. Voila -- welcome to 2006!

If you are a designer or developer, there is an additional template called "Ajax Tableless Layout" which is completely unstyled but puts all of the form fields into divs (very similar to the Form Tableless Layout addon), so you can style them yourself via your theme's CSS.
If you're not a web designer or developer, you should completely ignore the "Ajax Tableless Layout" template and just stick to the "Ajax Default Layout" template, otherwise your forms will look weird.

Some notes for the detail-oriented folks:

  • This addon "degrades gracefully" -- if the user has javascript disabled for some reason, it reverts to the normal "page reload" behaviour.
  • Ajax functionality will not be used when a file upload field exists on the form (it will automatically revert to the normal "page reload" behaviour).
  • Ajax functionality will not be used if you choose the "Redirect to another page after form submission" option when adding/editing the form.
  • While this addon is installed, an additional javascript file will be sent by the server on all page requests (even if there is no form block on that page). This additional file is about 25K (uncompressed), which is not that big of a deal for most situations -- it's smaller than most header images, for example -- but if you're obsessed with optimization, this might bother you.

Enjoy!

   -Jordan Lev

Special thanks to Greg Joyce for writing a how-to that addressed the one insurmountable issue I had along the way, and to Peter Vernaglia for the inspiration.

Add to Cart

Sales have ended due to EOL

Approved by PRB

Our 30 Day Support Policy

  • Replies to tickets every few days.

Support Hosted

  • On concrete5.org