2017 © Pedro Peláez
 

contao-module contao-ajaxform

Ajax Form extension for Contao Open Source CMS

image

terminal42/contao-ajaxform

Ajax Form extension for Contao Open Source CMS

  • Tuesday, February 27, 2018
  • by aschempp
  • Repository
  • 3 Watchers
  • 9 Stars
  • 2,605 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 12 Versions
  • 18 % Grown

The README.md

ajaxform

🚨 This extension will become unsupported once Contao 4.13 LTS is EOL. This is because we have contributed the feature to Contao Core. You can use it as of Contao version 5.1 and you will thus no longer need this extension 🎉, (*1)

Allows you to submit your forms that were generated with the built-in form generator via Ajax. After the installation you will have a new content element called "Form with Ajax" available. Simply choose that and enjoy the magic., (*2)

It also works with redirects so you can use it in combination with e.g. "mp_forms"., (*3)

This extension does not require jQuery or MooTools and thus only works in modern browsers., (*4)

Migration from contao-ajaxform to the Contao Core feature as of 5.1

A manual migration is very easy:, (*5)

First, search for all the content elements of type ajaxform. If you want to do it on database level, you can do it by running SELECT * FROM tl_content WHERE type='ajaxform'. Then, do the following steps for every single one of them:, (*6)

  1. Copy the confirmation text to your clipboard.
  2. Go to the respective form, enable the new Ajax confirmation message feature and paste your confirmation text.
  3. Replace the ajaxform content element with the regular form content element.
  4. Uninstall the extension.

You can also automate it by using the Contao Migration framework in your app. The migration needed looks like this:, (*7)

namespace App\Migration;

use Contao\CoreBundle\Migration\AbstractMigration;
use Contao\CoreBundle\Migration\MigrationResult;
use Doctrine\DBAL\Connection;

class AjaxFormMigration extends AbstractMigration
{
    public function __construct(private readonly Connection $connection)
    {
    }

    public function shouldRun(): bool
    {
        $schemaManager = $this->connection->createSchemaManager();

        if (!$schemaManager->tablesExist(['tl_content', 'tl_form'])) {
            return false;
        }

        $columns = $schemaManager->listTableColumns('tl_form');

        if (!isset($columns['ajax'], $columns['confirmation'])) {
            return false;
        }

        $total = $this->connection->fetchOne('SELECT COUNT(*) FROM tl_content WHERE type=?', ['ajaxform']);

        return $total > 0;
    }

    public function run(): MigrationResult
    {
        $records = $this->connection->fetchAllAssociative('SELECT id, form, text FROM tl_content WHERE type=?', ['ajaxform']);

        foreach ($records as $record) {
            $this->connection->update('tl_content', ['type' => 'form'], ['id' => $record['id']]);
            $this->connection->update('tl_form', ['confirmation' => $record['text'], 'ajax' => 1], ['id' => $record['form']]);
        }

        return $this->createResult(true);
    }
}

The Versions

27/02 2018

dev-master

9999999-dev

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

27/02 2018

dev-develop

dev-develop

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

27/02 2018

1.0.7

1.0.7.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

27/02 2018

dev-hotfix/1.0.7

dev-hotfix/1.0.7

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

26/02 2018

1.0.6

1.0.6.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

26/02 2018

dev-hotfix/1.0.6

dev-hotfix/1.0.6

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

23/05 2017

1.0.5

1.0.5.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

28/03 2017

dev-hotfix/1.0.5

dev-hotfix/1.0.5

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

form ajax contao submit

27/03 2017

1.0.4

1.0.4.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

form ajax contao submit

29/08 2016

1.0.3

1.0.3.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

form ajax contao submit

23/05 2016

1.0.2

1.0.2.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

form ajax contao submit

30/06 2015

1.0.1

1.0.1.0

Ajax Form extension for Contao Open Source CMS

  Sources   Download

LGPL-3.0+

The Requires

 

form ajax contao submit