0
votes

Is there any way to configure TYPO3 Better Contact extension to handle multiple forms across the site?

In default config example i can only see one form defined. I can add many instances of form to my pages and change form html template (and there: use different fields) but I don't know if (or where) it is possible to define which typoscript config file should my form use.

Or should I define ALL fields in one config (let's say fields A, B, C and D) and use only desired ones in each instance (let's say A and B in instance 1 and C and D in instance 2 if I want 1 and 2 to be completly different)?

I'm a typo3 newbie so I'm kinda blind...

1

1 Answers

0
votes

1. Usually, you can define several options in the plugin's content element that is inserted on the according page (called Flexforms). You find most of them in the tab "Plugin Options". Parameters from the flexform override parameters from the setup. If not set, default values will be used.

2. As an alternative, you can insert different TypoScript setups into the template of each page. Parameters are inherited (an overwritten) along the rootline if you use an Extension template for child pages. Therefore you only have to change the values that are different from the default template.

3. Third option: You can use TypoScript conditions in your (root) setup. In this example, one form is inserted on page ID 1, another one on page ID 99, which uses a different HTML template and different form validation. Make sure to understand the concept of conditions in Typoscript before you use this code. (I left out most of the setup code using [...])

[PIDinRootline = 1]
plugin.tx_spbettercontact_pi1 {

    formTemplate         = fileadmin/your-template-file01.html
    emailTemplate        = fileadmin/your-template-file01.html

    [...]

    fields {
        name {
            required     = 1
            minLength    = 3
            maxLength    = 70
            disallowed   = 0123456789<>(){}!?%&§$/+-\
        }

        [...]

    }
}
[PIDinRootline = 99]
plugin.tx_spbettercontact_pi1 {

    formTemplate         = fileadmin/your-template-file02.html
    emailTemplate        = fileadmin/your-template-file02.html

    [...]

    fields {
        name {
            required     = 0
            minLength    = 10
            maxLength    = 200
            disallowed   = <>(){}!?%&§$/+-\
        }

        [...]

    }
}
[GLOBAL]