We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Adding a data attribute to a form with Volt

Hello there,

I'm using the Foundation framework and to get client side validation working on a form I need to add the attribute "data-abide" to the form element itself. How would I go about doing this?

Currently I have {{ form('session/start', 'role': 'form') }}

Thanks Dan

edited Aug '15

Hi Dan!

You can add any attributes, just like that

{{ form('session/start', "method": "post", "data-abide": ""}}

In HTML it will be format like normal form with

<form action="/session/start" method="post" data-abide="">

Ah, I tried that but I don't need a "parameter value pair" if that makes sense, just the key... I tried just putting "data-abide" but it seemed to get escaped/removed when looking at the source, unless I'm being an idiot



5.0k

{{ form('session/start', "method": "post", "data-abide": ""}}

Ah, thank you! I will try that today