• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dropdown default value

#1
[eluser]Ninja[/eluser]
Controller
Code:
$client = new Client();
            $client->get('id');
    
            foreach($client->all as $entry)
            {
                $clientID = $entry->id;
                $entry->company->get('companyname');
                $companyName = $entry->company->companyname;
                $data['parent'][$clientID] = $companyName;    
            }

View
Code:
<?php echo form_dropdown('Parent', $parent )?>

Im trying to set the default value for the dropdown to something like “Not Applicable”
With an index of 0. This dropdown is for Parent clients (ie. The client of a client) but not all clients will have a parent client.
I cant set the 3rd parameter to "Not Applicable" with index 0 because its not in the array. and i cant seem to add it to the array because the array is populated from a database table Clients which contains 3 fields:
id serial,
parent_client interger,
company_id,


Messages In This Thread
Dropdown default value - by El Forum - 07-17-2009, 01:17 AM
Dropdown default value - by El Forum - 07-17-2009, 05:26 AM
Dropdown default value - by El Forum - 07-17-2009, 05:38 AM
Dropdown default value - by El Forum - 07-17-2009, 05:42 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.