Welcome Guest, Not a member yet? Register   Sign In
form_submit - Adding a class
#1

[eluser]Shella[/eluser]
Hi everybody,
I'm kinda new with codeigniter and I'm looking to manage this form_submit styling.

Actually if I use:

Code:
form_submit('submit', 'Publish');

I return this:

Code:
<input type="submit" value="Publish">

What I can do to return:

Code:
<input type="submit" value="Publish" class="alt_btn">

Thank fools!

Shella
#2

[eluser]Unknown[/eluser]
Code:
$attributes = array('class' => 'my_class');
form_submit('submit', 'Publish', $attributes);
#3

[eluser]sanir[/eluser]
Please checkout user guide for form helper.
http://ellislab.com/codeigniter/user-gui...elper.html

Thanks,
Nasir Ranta
#4

[eluser]Shella[/eluser]
Mmmm...
don't ask me WHY but I followd your tips and it doesn't work like that.
I managed coding this. It works but sincerely I don't know if this is a workaround or something else:

Code:
$attributes = array('class' => 'class="alt_btn"');
echo form_submit('submit', 'Publish', $attributes['class']);

Thanks
#5

[eluser]sanir[/eluser]
Code:
$attributes = 'class = "alt_btn"';
echo form_submit('submit', 'Publish', $attributes);
try this code.
#6

[eluser]Shella[/eluser]
Yep, working. I understand how it works thanks.
By the way I guess the user manual related is not appropriate in this case, don't you reckon?

Cheers & thank for help
#7

[eluser]Aken[/eluser]
The third parameter expects a string, not an array. The user guide doesn't specify which format it should be in, which could be improved upon.
#8

[eluser]Unknown[/eluser]
You could just do

echo form_submit('send', 'Publish', 'class="alt_btn"');




Theme © iAndrew 2016 - Forum software by © MyBB