TYPO3 Femanager Passwort additionalAttributes

623 views Asked by At

I want to extend the additionalAttributes with a second Attribute. In the original Partials it looks like this:

<f:form.password
            id="femanager_field_password_repeat"
            name="password_repeat"
            class="input-block-level"
            value=""
            additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'password_repeat')}" />

I try this:

additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'password'),placeholder: '{password_repeat}'}" />

With several Verions of Escaping the femanager:Validation..... Got this Error:

The argument "additionalAttributes" was registered with type "array", but is of type "string" in view helper "TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper“

Any Ideas?

1

There are 1 answers

0
Matthias Secker On

I think

Validation.FormValidationData()

is a viewhelper that returns a whole array which is expected for the attribute "additionalAttributes". Because of that it's difficult to extend the array at this place.

But as far as I know the femanager-viewhelper itself offers the possibility to extend the final array, all to do is to give your array as a further argument which is called 'additionalAttributes' as well.

A short example:

<f:form.password
     property="password"
     additionalAttributes="{
       femanager:Validation.FormValidationData(settings:settings,
       fieldName:'password',   
       additionalAttributes:'{required:\'required\',pattern:\'.{8,}\'}')}"
     }" />

Notice the array of 2 values (required and pattern).

I also recommend to have a look at the viewhelper on github:

https://github.com/TYPO3-extensions/femanager/blob/master/Classes/ViewHelpers/Validation/FormValidationDataViewHelper.php