Search code examples
phpphalconvolt

Adding id and attributes to Form element, Volt engine and Phalcon 3


I was trying to add an id to form element in Phalcon using volt syntax. But never found a solution for it.

Here is how I render the form:

{{ form("admin/saveSettings", "method": "post") }}

Solution

  • It is simple as that:

    {{ form("admin/saveSettings", "method": "post", "id": "form-id", "class": "css-class") }}
    

    You can add more attributes by separating them with commas.

    More examples of Tag Helpers can be found in the docs.