• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form_dropdown not showing text, but shows key instead

#1
[eluser]Unknown[/eluser]
When I try to add a dropdown using the form_dropdown array, my website is doing something strange. It displays the key ("1"), and not the text ("GSAA"), UNTIL I press on the dropdown and select an item. Then it switches the display to show text instead of keys.

Here is my code:

Code:
<?php
$options = array('1'  => 'GSAA',
                  '2'    => 'EBSA',
                  '3'   => 'DSA',
                  '4' => 'Other'
                );

echo form_dropdown('ctr', $options, '2');
?>

What is going on?!?

Can't figure it out.

Thanks,

George

#2
[eluser]InsiteFX[/eluser]
Index 0 is a default setting.
Code:
<?php
echo form_open('controller/method');
$options = array(
    '0' => 'Select  Option',
    '1' => 'GSAA',
    '2' => 'EBSA',
    '3' => 'DSA',
    '4' => 'Other',
);

echo form_dropdown('ctr', $options, '2');

echo form_close();
?>

#3
[eluser]Unknown[/eluser]
Yes, I know.

I think my error has something to do with the Foundation framework (http://foundation.zurb.com/docs/) I am using. When I use this to create the form:

Code:
<?php    
$attributes = array('class' => 'custom', 'id' => '');
echo form_open('register/address', $attributes); ?>

This are screwed up. But when I take out "custom" from the class:
Code:
<?php    
$attributes = array('class' => '', 'id' => '');
echo form_open('register/address', $attributes); ?>

It works and shows the text values.

Ugh. I will have to look into Foundation then.

George

#4
[eluser]CroNiX[/eluser]
I was going to say it sounds like some javascript is interfering, since a browser would never do that behavior on it's own using HTML, which is what CI outputs.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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