切换标签并以TYPO3 7.6格式输入

时间:2016-02-06 18:28:27

标签: typo3 typoscript typo3-7.x typo3-7.6.x

在TYPO3 7.4中,可以在表格中切换标签和输入。出于某种原因,这在7.5和7.6中已经改变。

class = form
enctype = multipart/form-data
id = contact
method = post
layout {
            checkbox (
                    <input />
                    <label />
            )
}
prefix = tx_form
confirmation = 0

这是一个已知的错误还是有新方法可以做到这一点?

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:4)

EXT:表格在7.5中完全重写。整个前端渲染被extbase和fluid取代。

不幸的是,并非所有变更都已记录在案。几周前,我对文档进行了大量清理,可在此处找到:https://docs.typo3.org/typo3cms/extensions/form/layout section对你来说更有趣。链接文档将解释如何设置视图特定布局。

但是,在TYPO3 7.6中定制布局时,通过TypoScript使用.layout东西不再是最好的方法了。正如changelog所示,您应该使用流体。以下示例描述了包含一些新功能的表单。我在全球范围内设置了一个额外的部分路径。但也可以为特定表单元素设置部分路径(参见元素&#34; 900&#34;)。

plugin.tx_form {
    view {
        # set up additional partial path
        partialRootPaths.20 = EXT:generic_lib/Resources/Private/Extensions/Form/Partials/
    }
}

# build contact form
lib.default_contact_form = FORM
lib.default_contact_form {
    prefix = {$content.mailform.prefix}
    confirmation = 1
    # want to work on a clean base without .layout settings
    compatibilityMode = 0

    postProcessor {
        1 = mail
        1 {
            recipientEmail = {$content.mailform.recipientEmail}

            senderNameField = name
            senderEmailField = email

            ccEmail = TEXT
            ccEmail {
                # depends on the fact that email is required and tested
                data = GP:tx_form_form|{$content.mailform.prefix}|email
                htmlSpecialChars = 1
            }

            subject = TEXT
            subject {
                value = [{$website.title}] - Kontakt
                lang.en = [{$website.title}] - Contact
                lang.es = [{$website.title}] - Contacto
                lang.it = [{$website.title}] - Contatto
            }
        }

        2 = redirect
        2.destination = {$content.mailform.redirectPage}
    }

    10 = TEXTLINE
    10 {
        name = name
        required = required
        type = text
        label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:name
        placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:name
    }

    20 = TEXTLINE
    20 {
        name = email
        type = email
        required = required
        label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:email
        placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:email
    }

    30 = TEXTAREA
    30 {
        name = message
        cols = 40
        rows = 5
        required = required
        data-foo = bar
        label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:message
        placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:message
    }

    900 = TEXTLINE
    900 {
        name = honeypot
        type = text
        label.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:spam
        placeholder.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:spam
        autocomplete = off
        partialPath = FlatElements/Honeypot
        # hide field in confirmation and mail views
        visibleInConfirmationAction = 0
        visibleInMail = 0
    }

    1000 = SUBMIT
    1000 {
        name = submit
        value.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:submit
        class = button
    }

    rules {
        1 = required
        1 {
            element = name
            message.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:required
            error.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:mandatory
        }

        2 = email
        2 {
            element = email
            message = (max.muster@domain.com)
            error.data = LLL:EXT:my_ext/Resources/Private/Language/Form/locallang.xlf:mandatory_email
        }
    }
}

如果您需要任何进一步的帮助,可以加入typo3.slack.com并打开分机频道。在那里,你会找到更多的例子和即时帮助。