CodeIgniter Forums
Applying a style sheet class to a Form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Applying a style sheet class to a Form (/showthread.php?tid=54601)



Applying a style sheet class to a Form - El Forum - 09-16-2012

[eluser]MightyBishop[/eluser]
Hi all,

Still very new to all this, but loving it! Bit confused about applying style sheets to the form_open() command.

Say I want to end up with something like this in my page:

Code:
<form class="form-style">

How do I go about applying that class to the form_open() command?

I read somewhere else about adding on a style as an extra parameter to something, but for the life of me I can't remember - old age creeping in!

Thanks for any help,

Best regards

JB


Applying a style sheet class to a Form - El Forum - 09-16-2012

[eluser]TWP Marketing[/eluser]
From the User Guide:
http://ellislab.com/codeigniter/user-guide/helpers/form_helper.html

Quote:Adding Attributes

Attributes can be added by passing an associative array to the second parameter, like this:

Code:
$attributes = array('class' => 'email', 'id' => 'myform');

echo form_open('email/send', $attributes);

The above example would create a form similar to this:
Code:
<form method="post" accept-charset="utf-8" action="http:/example.com/index.php/email/send"  class="email"  id="myform" />



Applying a style sheet class to a Form - El Forum - 09-17-2012

[eluser]MightyBishop[/eluser]
Aha!

RTM comes to mind. Thank you very much for this.

Best regards

JB