无法在TYPO3流体联系表单

时间:2017-05-02 14:43:42

标签: forms typo3 action fluid

我们正努力设法运行一个简单的联系表单。但无论我们尝试什么,我们什么都得不到。

表单本身位于前端,配置如下:

    <f:section name="Main">


    <div class="ext-frame container">
        <h2>{record.header}</h2>

        <f:form action="submit" name="order" object="{order}" class="form-horizontal">

            <f:for each="{settings.offer}" as="obj" key="id">
                <div class="row offer">
                    <f:if condition="{obj.offer.img}">
                        <f:then>
                            <div class="col-sm-4 col-md-4 offer-img-container">
                                <img src="../{obj.offer.img}" class="offer-image" alt="{obj.offer.img.alternative}" />
                            </div>
                        </f:then>
                    </f:if>
                    <div class="col-sm-8 col-md-8 {f:if(condition: '{obj.offer.img} == \'\'', then: 'col-sm-offset-4 col-md-offset-4')}">
                        <label class="offer-label">
                            <f:form.radio property="offer" value="{id}" />
                            <div class="pull-right">
                                <p class="lead">
                                    {obj.offer.title}<br/>
                                    <small>{obj.offer.subtitle}</small>
                                </p>
                                <p class="small">{obj.offer.description}</p>
                            </div>
                        </label>
                    </div>
                </div>
                <hr />
            </f:for>

            <div class="form-group row">
                <label for="salut" class="col-sm-3 control-label">Anrede*</label>
                <div class="col-sm-5">
                    <f:form.select property="salut" options="{herr: 'Herr', frau: 'Frau'}" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <label for="name" class="col-sm-3 control-label">Vorname*</label>
                <div class="col-sm-5">
                    <f:form.textfield property="name" value="" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <label for="surname" class="col-sm-3 control-label">Nachname*</label>
                <div class="col-sm-5">
                    <f:form.textfield property="surname" value="" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <div class="col-sm-3 cusnr">
                    <label for="cusNr" class="control-label">Kundennummer</label>
                    <span id="helpBlock" class="help-block">(wenn bekannt)</span>
                </div>
                <div class="col-sm-5">
                    <f:form.textfield property="cusNr" value="" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <label for="addr" class="col-sm-3 control-label">Straße/Hausnr.*</label>
                <div class="col-sm-5">
                    <f:form.textfield property="addr" value="" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <label for="zip" class="col-sm-3 control-label">PLZ*</label>
                <div class="col-sm-3">
                    <div class="input-group">
                        <span class="input-group-addon">D-</span>
                        <f:form.textfield property="zip" value="" class="form-control" type="number" maxlength="5" />
                    </div>
                </div>
            </div>

            <div class="form-group row">
                <label for="city" class="col-sm-3 control-label">Ort*</label>
                <div class="col-sm-5">
                    <f:form.textfield property="city" value="" class="form-control" />
                </div>
            </div>

            <div class="form-group row">
                <label for="mail" class="col-sm-3 control-label">E-Mail*</label>
                <div class="col-sm-5">
                    <f:form.textfield property="mail" value="" class="form-control" type="email" />
                </div>
            </div>

            <div class="form-group row">
                <label for="phone" class="col-sm-3 control-label">Telefon</label>
                <div class="col-sm-5">
                    <f:form.textfield property="phone" value="" class="form-control" type="tel" />
                </div>
            </div>

            <div class="form-group row"><div class="col-sm-offset-3 col-sm-5">
                <f:form.select property="know" options="{
                    0: 'a?*',
                    1: 'a',
                    2: 'b',
                    3: 'c',
                    4: 'd',
                    5: 'e',
                    6: 'f',
                    7: 'g'
                }" class="form-control" />
            </div></div>

            <div class="form-group row">
                <div class="col-sm-offset-3 col-sm-9">
                    <div class="checkbox">
                        <label>
                            <f:form.checkbox name="term" value="1" />
                            Ich habe die <a href="agb.php" target="_blank">AGB</a> gelesen und erkläre mich mit
                            ihnen einverstanden. Ich wurde über mein <a href="widerruf.php" target="_blank">
                            Widerrufsrecht</a> informiert.
                        </label>
                    </div>
                </div>
            </div>


            <div class="form-group row">
                <f:form.submit name="submit" value="Send" class="col-xs-12 col-sm-5 col-sm-offset-3 btn" />
            </div>

        </f:form>

    </div>

</f:section>

在我们的ContentController.php中还提供了一个submitAction,但似乎永远不会调用此Action:

    public function submitAction() {
    echo 'Testoutput';exit;
}

1 个答案:

答案 0 :(得分:0)

提交后表单会在哪里引导您?如果一切正确,请查看最终的HTML动作=“”。 尝试将表单“方法”设置为POST。我刚刚使用GET的表单遇到了一些问题,因为目标PID由于未知原因而丢失,因此我必须添加<input type="hidden" name="id" value="{targetPid}" />才能使其正常工作。