Welcome Guest, Not a member yet? Register   Sign In
Form problem with dropdown
#1

[eluser]Unknown[/eluser]
Hi all,

I'm using tank_auth and i'm updating the files to add some extra fields. Everything works fine except a dropdown filled with data returned form a sql query. I configured the dropdown in the register form. In the view I configure the array options in top of file:
Code:
$grupo = array(
    'name'  => 'grupo',
    'id'    => 'grupo',
    'value' => set_value('grupo'),
);

then populate the dropdown:
Code:
<div class="control-group">
        &lt;?php echo form_label('Grupo', $grupo['id'], array('class' => 'control-label')); ?&gt;
        <div class="controls">
            &lt;?php echo form_error('grupo'); ?&gt;  
            &lt;?php echo form_dropdown('grupo',$list_groups)?&gt;
            <p class="help-block"></p>
        </div>
</div>

I assign the form_validation in the controller:
Code:
$this->form_validation->set_rules('grupo', 'Grupo', 'trim|required|xss_clean');
and the set_value()
Code:
$data = $this->tank_auth->create_user(
      $use_username ? $this->form_validation->set_value('username') : '',
      $this->form_validation->set_value('email'),
      $this->form_validation->set_value('password'),
      $this->form_validation->set_value('grupo'),
      $email_activation
      )))

In the library I add the new column:
Code:
$data = array(
    'username' => $username,
    'password' => $hashed_password,
    'email'  => $email,
    'servicegroup' => $grupo,
    'last_ip' => $this->ci->input->ip_address(),
   );

In the model simply passed the $data with all arguments included the $grupo variable.
The array with fill the dropdown contains next data:
Code:
Array ( [cliente1] => cliente1 [cliente2] => cliente2 [cliente3] => cliente3 )

No errors returned in the submit but the field is empty, I notice that no data are submited with the dropdown.

What's wrong? May be are other way?

Thanks a lot!
#2

[eluser]Unknown[/eluser]
Solved!!
just a simple problem with the argument order. :roll:




Theme © iAndrew 2016 - Forum software by © MyBB