简体   繁体   中英

Unwanted hidden field and missing for attribut in checkbox (TYPO3, Powermail)

I have a problem with TYPO3/Powermail. I tried to add custom checkbox images and ran into problems with IE. I found another website based on TYPO3 with customized checkboxes working fine on IE too.

What is weird is, that my html form structure (generated by TYPO3/Powermail) looks different.

Here is my checkbox html:

在此处输入图片说明

As you can see, I have a field with type hidden inserted, don't know why. And my label has no "for" attribut.

This form field here (TYPO3/Powermail as well) looks nice:

在此处输入图片说明

Here we have no strange hidden input field, and there is a "for" attribut in the label.

Can someone help?

The templates of the both installations differ. Check the original templates and partials delivered with EXT:powermail in folder EXT:powermail/Resources/Private. If you use own templates add all needed fields and options.

For example add the for -attribute to the <label> in partial for radio buttons: <label for="powermail_field_{field.marker}_{index.cycle}"> .

In newer versions of EXT:powermail (7.3.1) file Resources/Private/Partials/Form/Field/Radio.html looks like:

{namespace vh=In2code\Powermail\ViewHelpers}

<div class="powermail_fieldwrap powermail_fieldwrap_type_radio powermail_fieldwrap_{field.marker} {field.css} {settings.styles.framework.fieldAndLabelWrappingClasses}">
    <f:render partial="Form/FieldLabel" arguments="{_all}" />

    <div class="{settings.styles.framework.fieldWrappingClasses}">
        <f:for each="{field.modifiedSettings}" as="setting" iteration="index">
            <div class="{settings.styles.framework.radioClasses} {vh:Validation.ErrorClass(field:field, class:'powermail_field_error')}">
                <label>
                    <f:form.radio
                            property="{field.marker}"
                            value="{setting.value}"
                            checked="{vh:Misc.PrefillMultiField(field:field, mail:mail, cycle:index.cycle)}"
                            id="powermail_field_{field.marker}_{index.cycle}"
                            additionalAttributes="{vh:Validation.ValidationDataAttribute(field:field, iteration:index)}"
                            class="powermail_radio" />
                    <vh:string.escapeLabels>{setting.label}</vh:string.escapeLabels>
                </label>
            </div>
        </f:for>

        <f:if condition="{settings.validation.client}">
            <div class="powermail_field_error_container powermail_field_error_container_{field.marker}"></div>
        </f:if>
    </div>

Resources/Private/Partials/Form/FieldLabel.html:

{namespace vh=In2code\Powermail\ViewHelpers}

<f:comment>
    Partial file for the HTML-structure of nearly all field labels
</f:comment>

<f:if condition="{field.css} != 'nolabel'">
    <label for="powermail_field_{field.marker}" class="{settings.styles.framework.labelClasses}" title="{field.description}">
        <vh:string.escapeLabels>{field.title}</vh:string.escapeLabels><f:if condition="{field.mandatory}"><span class="mandatory">*</span></f:if>
    </label>
</f:if>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM