Adding a class to the form tag

8 months ago

blackcat562
Member | 7
+
0
-

Is there a way to add a class to the <form> tag?

8 months ago

David Matějka
Moderator | 5988
+
+2
-

Yes, there are a few ways:

  • you can add a class directly in PHP using $form->getElementPrototype()->class('my-class')
  • or if you are rendering a form manually in latte, you can set a class in macros using {form myForm class => 'abc'} or <form n:name='myForm' class='abc'>

8 months ago

blackcat562
Member | 7
+
0
-

Thank you!