Welcome Guest, Not a member yet? Register   Sign In
CI form help
#1

[eluser]UdayD[/eluser]
I just read that to write a form input i have to write as below:
Code:
$data = array(
              'name'        => 'username',
              'id'          => 'username',
              'value'       => 'johndoe',
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'width:50%',
            );

echo form_input($data);
but if i have to write 10 inputs with same length, size and style.
how will i do that do i need to make ten different arrays and the pass them to
echo form_input($array1);...
how will i do this?? is their a simpler way?
Thanks in advance
#2

[eluser]UdayD[/eluser]
i got it how can i do that

Code:
$options=array(
              'maxlength'   => '100',
              'size'        => '50',
              'style'       => 'width:50%',
            );
$array1=array{ 'name'        => 'username',
              'id'          => 'username',
              'value'       => 'johndoe',
                }
$array2=array{ 'name'        => 'email',
              'id'          => 'email',
              'value'       => '',
              }
$array3=array{ 'name'        => 'Phone',
              'id'          => 'phone',
              'value'       => '',
              }

and then i can write

echo form_input($array1,$options);
echo form_input($array2,$options);
echo form_input($array3,$options);
#3

[eluser]Ivar89[/eluser]
Make an array and name is tomsething
then in there you sart an array with arraysTongue
Code:
$config = array('contact' => array(array('field' => 'fieldname',
                                            'label' => 'bedrijfsnaam'
                                            'rules' => 'trim|required|callback_check_form'
                                             ),
                                     array('field' => 'fieldname',
                                           'label' => 'Naam',
                                           'rules' => 'trim|required'
                                             ),
                                    array('field' => 'fieldname',
                                          'label' => 'adress',
                                          'rules' => 'trim|required'
                                             ),
//and so on and add Id's and whatever you want.
EDIT: Oh crap I read it wrong I posted a form validation srryTongue
#4

[eluser]Ivar89[/eluser]
simpler way?
Code:
<label id="input">
&lt;input type="text" name="name" Id="id" value="value" style="widht: 500px" /&gt;
</label>
#5

[eluser]UdayD[/eluser]
means use direct form elements.not to use CI form helper???
#6

[eluser]Ivar89[/eluser]
yhea, I mean its easier it doesn't say you HAVE to use the helper...




Theme © iAndrew 2016 - Forum software by © MyBB