Component -> Select List

For Joomla! 1.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Locked
jmul
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Mar 25, 2010 2:17 pm

Component -> Select List

Post by jmul » Thu Mar 25, 2010 2:50 pm

Hi,

I hope I´m right in this section. Since my searches didn`t give a answer I am able to understand :), hopefully somebody is able to help me and make me understand how this works.

I made a new Componente in wich one can add User and Categories. Since this categories differ from the ones joomla provides, i made a new table called component_category (component is not the real name, i don`t want to write it here).
In addition I´ve got a table in wich i store the added user called component (name of the component). So now there are two tables.

My problem is, I want to show in the default view of the Component add-task, a dropdown list or select, in wich all the usere stored in the databse are selectable. This is needed since I want one of those user to be responsible for this category.
The first problem is, how do I display such a select-box with the surname and prename out of the table for the user. And the second problem is, how do i store the selected user in the category table as prename, surname and his user-id?

What i already did:

Model category:

Code: Select all

function _buildQuery()
	{
		$query = ' SELECT prename, surname FROM #__component ';

		return $query;
	}

function &getUser()
	{
		// Load the data
		if (empty( $this->_data ))
		{
			$query = $this->_buildQuery();
			$this->_user = $this->_getList( $query );
		}
		return $this->_user;
	}

view.html.php of category:

Code: Select all

$user	=& $this->get('User');

Now I found something with wich probably i can do that, but I actually don`t know how:
$lists['user'] = JHTML::_('select.genericlist', $user , 'cid', 'class="inputbox" size="1"','cid', 'name', $category->user);
$this->assignRef('lists', $lists);

with the $category->user, I tried to store the selected item in the table component_category as user but nothing happens.

when i try to display the whole thing in the default.php with:
<?php echo $lists['user']; ?>

nothing happens.

Maybe somebody can tell me the whole way I have to do this.

Greetings,

jmul

User avatar
dam-man
Joomla! Exemplar
Joomla! Exemplar
Posts: 7961
Joined: Fri Sep 09, 2005 2:13 pm
Location: The Netherlands
Contact:

Re: Component -> Select List

Post by dam-man » Fri Mar 26, 2010 6:20 pm

Please don't bump your topics, I have removed it.
Robert Dam - Joomla Forum Moderator
Dutch Boards | Joomla Coding Boards | English Support Boards


Locked

Return to “Joomla! 1.5 Coding”