Not one to give up easily, if at all... I gave it another try. I
remember reading a post somewhere that an easy way to add an entry to
the beginning of a dropdown list was like this:

echo $form->input(
   'county_id',
   array(
      'options' => array('Please pick a country') + $counties
   )
);

So I experimented in the ajax_dropdown.ctp file and did this:

<?php $options = array('Pick me!') + $options; ?>
<?php foreach($options AS $k=>$v) : ?>
<option value="<?php echo $k; ?>"><?php echo $v; ?></option>
<?php endforeach; ?>

Now it works! I can tell the ajax observeField is firing the
ajax_dropdown.ctp because I get "Pick me!" as the first entry and all
the elements in the dropdown are correct in name and in id value.

Whew!

Is there a better way to do this, or just be glad it does and move on?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to