The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Aug 10, 2012 12:11 pm 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Sun Jul 12, 2009 12:04 pm
Posts: 169
Hi,

I use a drop down list with multiple selection so I
create a custom field in order to build a drop down list
the way I want to.
Code:
class JFormFieldMyList extends JFormFieldList
{
  protected $type = 'mylist';

  protected function getOptions()
  {
    $options = array();
     
    ...

    foreach($items as $item)
    {
      ...
     
      $options[] = JHtml::_('select.option', $item->id, JText::_($item->title));
    }

    return $options;
}

But I just can't figure out how to make some options selected (selected="selected").

Can someone helps me ?


Thanks


Top
 Profile  
 
PostPosted: Sat Aug 11, 2012 6:40 pm 
Joomla! Ace
Joomla! Ace

Joined: Sat Oct 01, 2011 7:06 pm
Posts: 1361
Have a look http://api.joomla.org/Joomla-Platform/HTML/JHtmlSelect.html See genericlist


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group