By deelite on
Hi,
i need to add a css class to the form tag of my webform(s).
But i have absolutely no idea how to get it done.
Can anyone help me please?
Thanks for reading this!
Hi,
i need to add a css class to the form tag of my webform(s).
But i have absolutely no idea how to get it done.
Can anyone help me please?
Thanks for reading this!
Comments
Hook form alter
You could try using hook_form_alter.
In your theme's template.php file you would add a function something like:
To get the id-of-form, you can 'inspect' the html of the page and if you take the id of the form and convert the dashes to underscores, this will be the id-of-form. So using the html example below, the id-of-form is webform_client_form_1
<form id="webform-client-form-1" class="webform-client-form myclass" accept-charset="UTF-8" method="post">Hope this helps
Thank you.I have another
Thank you.
I have another form_alter in my template.php so i had to combine both functions.
Both in a separate function brings a blank page.
I use this code:
But it doesn't work.
For testing i removed the first function, buth with no success.
Could you please have a look over the code?
And is it possible to get the function for all forms without having a function for every single one?
Example looks ok
The code in your example looks fine except in the 'if' test the webform id needs to use underscores. ie.
Ed
It works! Thank you so much,
It works!
Thank you so much, Ed!
Awesome! Thank you both.
Awesome! Thank you both.
Josh Utley, President & CEO
Intrepid Network Inc. | Multimedia Services & Business Solutions
"Our mission is to provide a more personable multimedia service along with the highest quality business solutions."