The Joomla! Forum ™





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Jul 27, 2008 11:33 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jun 27, 2008 1:14 pm
Posts: 13
I have a combobox in joomla where you can select multiple values with holding the CTRL-key.
Now I want to see the selected values in the combobox when I edit that record.

I have a group. And in this group you can add multiple groupmembers/users.
My combobox code looks like this:

$query = "SELECT groupmember_id as value, groupmember_name as text FROM jos_groupmembers";
$db->setQuery( $query );
$rowsGroupMembers = $db->loadObjectList();
$mode = "";
if($this->_task == 'edit'){
$rowsGroupMembers['groupmember_name'] = JHTML::_('select.genericlist',
$rowsGroupMembers, 'groupmember_id[]', 'size="10" multiple', 'value', 'text',
$row->groupmember_id);

$mode = "edit";

} else{
$rowsGroupMembers['groupmember_name'] = JHTML::_('select.genericlist',
$rowsGroupMembers, 'groupmember_id[]', ' size="10" multiple' );
$mode = "add";
}

It is more about the edit part. How can I select the groupmembers from that group.
For example I have 4 users is my combobox but the first two are in the group. So when I edit that group I want to see the 4 groupmembers, but only the first two should be selected. How to do this in Joomla?

Vandana


Top
 Profile  
 
PostPosted: Sun Jul 27, 2008 12:37 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jun 27, 2008 1:14 pm
Posts: 13
Hi

I found the solution.

$rowsGroupMembers['groupmember_name'] = JHTML::_('select.genericlist', $rowsGroupMembers, 'groupmember_id[]', 'size="10" multiple', 'value', 'text', $rowsSelected);

$rowsSelected is the array of the selected members.
$rowsGroupMembers is the array with all the members

Vandana


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 2 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