Welcome Guest, Not a member yet? Register   Sign In
Repopulating in constructor form using form_validation class

[eluser]Chicken's Egg[/eluser]
I am migrating my website from CodeIgniter 1.6.3 to 1.7.0. I'm trying to alter the code so the new form_validation library will be used, but I keep having problems repopulating my form.

I have a controller called Blog with a function called config(). This function in the controller shows a configuration screen - which shows the current configuration of my weblog - which I load from a database. The form gets populated as wished and changes I make are - after I post the form - stored correctly in the database. So far so good. However, after posting the form the form is empty! Set_value doesn't seem to set the values I posted.

My question is:
Is it forbidden to use set_value() in the controller as shown below?

This is a part of my controller:
// Configuration for this module
  public function config()
    // Log message
    log_message('info', 'Controller:'. __METHOD__ . ' found and in use.');

    // Load language

    // Set down validation rules
    $config = array(
        'field'   => 'sMeta_keywords',
        'label'   => 'conf_sMeta_keywords',
        'rules'   => 'trim|xss_clean|max_length[250]'

    // If form is not send
      // Set language:
      $this->blog_config->sTaal = $_SESSION['taal'];

      // Receive already stored data;

    // Create form
    $hidden = array(
           'sTaal'      => $_SESSION['taal'],
    $fieldinfo = array(
           'class' => 'form',
           'accept-charset' => $this->data['meta_charset']
    $form['form_start']  = form_open('admin/'.$this->sModule.'/config/',$fieldinfo,$hidden);
      // Fieldset General start
    $form['form_txt']['label'][] = form_fieldset($this->lang->line('conf_fieldset_general').':') . "\t</p>\n\t<p>\n\t\t" . '<div class="label">'. form_label($this->lang->line('conf_sMeta_keywords'), 'Meta_keyword') .'</div>';
    $fieldinfo = array(
            'name'        => 'sMeta_keywords',
            'id'          => 'Meta_keyword',
            'cols'        => '50',
            'rows'        => '2',
            'value'       => set_value('sMeta_keywords', $this->blog_config->sMeta_keywords),
    $form['form_txt']['field'][] = form_textarea($fieldinfo);

The above is an abstract. Helpers, Libraries, Models and so on are loaded in the constructor.

Theme © iAndrew 2016 - Forum software by © MyBB