Put a Bootstrap class inside a form generated with CodeIgniter

0

Does anyone know how to tell me how I call the Bootstrap classes inside a form I generated using CodeIgniter? I've searched for an associative array, but I can not. For example, in the label I want to put class = 'sr-only' and in the input class="form-control input-lg".

echo form_open('crud/create');
echo validation_errors('<p>','</p>');
            echo form_label('Nome Completo');
            echo form_input(array('name'=>'nome'), '','autofocus');
            echo form_label('Email');
            echo form_input(array('name'=>'email'));
            echo form_label('Login');
            echo form_input(array('name'=>'login'));
            echo form_label('Senha');
            echo form_input(array('name'=>'senha'));
            echo form_label('Repita a senha');
            echo form_input(array('name'=>'senha2'));
            echo form_submit(array('name'=>'cadastrar');
echo form_close();
    
asked by anonymous 21.08.2015 / 14:30

2 answers

1

According to the CI documentation you should create an array with the attributes you want to add as follows:

$atributos = array (
'class' => 'sua class',
'style' => 'color: #fff;' );
// E assim por diante

And then add the variable attributes within your form_label ie

echo form_label('Nome Completo', $atributos);

You can see more details on CI documentation

    
21.08.2015 / 14:52
1

I was able to resolve it.

echo form_label('Nome Completo','',array('class'=>'sr-only'));
    
21.08.2015 / 14:50