Welcome Guest, Not a member yet? Register   Sign In
form_dropdown and set_select
#6

[eluser]ericrjones1[/eluser]
Peter,

I am pretty sure that my proposal works.

[quote author="Peter Lachky" date="1261542309"]

Code:
<?php echo form_dropdown('kategoria', $kategorie, set_value('kategoria', $kategoria)) ?>

[/quote]

Your proposed solution for resetting the form...

[quote author="Peter Lachky" date="1261542309"]

Code:
<?php echo form_dropdown('kategoria', $kategorie, $this->input->post('kategoria') ? $this->input->post('kategoria') : $kategoria) ?>

[/quote]

...is similar to what the set_value function is doing (check it out in the CI_Form_Validation Class).

Code:
function set_value($field = '', $default = '')
{
    if ( ! isset($this->_field_data[$field]))
    {
        return $default;
    }
        
    return $this->_field_data[$field]['postdata'];
}

I would check for the following items:

1. $kategoria is a key in the array $kategorie
2. $kategoria is of the expected type and value
3. check the return value of set_value() and how that is different from the $this->input->post() value


Messages In This Thread
form_dropdown and set_select - by El Forum - 11-14-2009, 12:35 AM
form_dropdown and set_select - by El Forum - 11-14-2009, 02:54 AM
form_dropdown and set_select - by El Forum - 11-15-2009, 03:58 AM
form_dropdown and set_select - by El Forum - 11-18-2009, 09:31 AM
form_dropdown and set_select - by El Forum - 12-22-2009, 04:25 PM
form_dropdown and set_select - by El Forum - 12-31-2009, 10:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB