Forms

From Snapp CMS Developer Documentation

Jump to: navigation, search

Contents

Default Processing Method

By default, form submissions are handled by the method moduleForm2::process().

The options for executing this method are controlled via the "CMS Processing" tab of the "Form Options" dialog in the CMS admin system.

See http://cms_api.crudigital.com.au under modules/forms/classes for more information.

Adding Custom Processing

It is possible to configure alternative form processing mechanisms to the default one.

Internal Processing

An alternative form handling method can be configured on a form by form basis. This is done by changing the "Custom Script" values in the "Custom Processing" tab of the "Form Options" dialog in the CMS admin system, as shown below.

Image:Custom_form_processing.jpg

Note that by changing these values from their default, the values on the "CMS Processing" tab are ignored.

In the example picture above, the alternative form processing method has been set to MyForm::process(). To handle this, you would need to create the file:

custom/MyForm.php

with the following code:

<?php
class MyForm {
    /**
     * Custom method for processing forms
     *
     * @param array fields Array of key/value pairs representing form fields 
    public function process($fields) {
        /* Do something with the form */
        var_dump($fields);
    }
}

Third-party Website Processing

By specifying a submission method and action URL in the "Third Party Form Processing" values in the "Custom Processing" tab of the "Form Options" dialog in the CMS admin system, the contents of the form will be submitted using GET or POST method to the nominated URL.

Personal tools
Core Components
Standalone Installs