Forums

CSS : is it possible to add a specific class?

pmarty 11 May, 2012
Hello,

I was wondering if it is possible to add a specific css class to the form?
I'm using the plugin to call a form in an article.
The form code begins with :
<form id="chronoform_Book" class="Chronoform hasValidation" method="post" name="Book" action="http://myweb.fr/misc/send-us-inquiry.html?chronoform=Book&event=submit">

Is it possible to add in the class value another css class?
So the class value would be: class="Chronoform hasValidation mystyle"

Thanks for your help
andypooz 11 May, 2012
Not sure why you don't just apply whatever styles you wanted on the .myStyle to .Chronoform, or #chronoform_Book id if you don't want other form to be affected. Not really what you want, but it should do the job shouldn't it?
pmarty 12 May, 2012
You're right, but I'm using a Yoo template which have a predefined style for forms, if you specify the correct css class.
I could change the stylesheet to add .chronoform to the yoo classes, but if theere was a way to add a css class to the chronoform forms, it will be much more easier🙂
GreyHead 12 May, 2012
Hi pmarty,

You could do it with JavaScript easily enough. There's no other easy way of adding a class to the <form> tag that I can think of :-(

Bob
pmarty 13 May, 2012
Ok Bob, Thanks you for this suggestion.
Maybe this possibility to add custom css class could be a new feature for the next release of Chronoform?😉
Maybe an option of the "Show html" action?

Thanks for all this job
pmarty 13 May, 2012
Helllo again,

In fact my last reply made me think to a possible way: modifiying the show html event myself.
So I opened the following file:
/administrator/components/com_chronoforms/form_actions/show_html/cfaction_show_html.php

And change the line 123 from:
$form_tag_array[] = 'class="Chronoform"';

to:
$form_tag_array[] = 'class="my_own_class"';

And it's perfect🙂 My form is now using "my_own_class" as css class.

So I really think, this could be defined as a parameter in the "show html" action:
"CSS class of the form:"
With a default value "Chronoform", that could be modified for user own use.

Hope it helps
Phil
pmarty 19 May, 2012
Great news!
I'll try that as soon as possible🙂
Thanks for the post and all your work on chronoform
Philippe
This topic is locked and no more replies can be posted.