L4DD13
L4DD13

Reputation: 220

ZF2 Form Element Data Attributes

This is more than likely going to be straight forward, or convoluted, but here goes...

How do you add a data attribute to a form element?

Upvotes: 0

Views: 898

Answers (2)

Volvox
Volvox

Reputation: 1649

Simply:

$element->setAttribute('data', 'somedata');

Upvotes: 3

L4DD13
L4DD13

Reputation: 220

Kicking myself right now!

Just remembered I'd already done it previously.

...
'attributes' => array(
    ...
    'data-xxx' => '',
    ...
),

>.<

Upvotes: 0

Related Questions