[TYPO3-mvc] HTML5 required attribute

KimPixel kimpixel+typo3v4mvc at googlemail.com
Thu Oct 11 20:55:49 CEST 2012


Hallo

can some help me please?
how can i make the required attribute conditional?

I have a lot of dynamic attributes in my viewhelper and i wont duplicate
the whole code:

<f:form.textfield

        value="{fieldHelper.value}"
        name="{form.name}[{fieldHelper.name}]"
        id="{form.name}_{fieldHelper.name}"
        class="formInput"

        maxlength="{fieldHelper.maxlength}"
        readonly="{f:if(condition: fieldHelper.config.readonly, then:
'readonly')}"
        disabled="{f:if(condition: fieldHelper.config.disabled, then:
'disabled')}"

        accesskey="{fieldHelper.config.accesskey}"
        tabindex="{f:if(condition: fieldHelper.config.tabindex, then:
fieldHelper.config.tabindex)}"

        placeholder="{placeholder}"

/>


this is not work:

   - required="{f:if(condition : '{fieldHelper.required}', then : 'true')}"
   - additionalAttributes="{f:if(condition : '{fieldHelper.required}', then
   : '{required:\'required\'}')}"
   - {f:if(condition : '{fieldHelper.required}', then : 'required="true"')}


Kim


More information about the TYPO3-project-typo3v4mvc mailing list