Welcome, Guest
Username: Password: Remember me

TOPIC: Custom Selectlist

Custom Selectlist 25 Oct 2012 08:05 #4732

  • goslingcools
  • goslingcools's Avatar
  • Offline
  • Senior Member
  • Posts: 64
  • Thank you received: 7
  • Karma: 1
Hi,

I'm trying to use a copy of your ckcombo.php field for some custom data.

I got my own values loaded and listed in the form. The value is saved correctly in the db.

But how / where do you set the selected(checked="checked") item?

Is this also done in this script?

<?php
/**                               ______________________________________________
*                          o O   |                                              |
*                 (((((  o      <    Generated with Cook Self Service  V2.0     |
*                ( o o )         |______________________________________________|
* --------oOOO-----(_)-----OOOo---------------------------------- www.j-cook.pro --- +
* @version		1.0
* @package		Franchisers
* @subpackage	
* @copyright	Copyright (C) 2012. All rights reserved.
* @author		Gosling Cools | COBIZ webdevelopment - http://www.cobiz.nl - info@cobiz.nl
* @license		GNU General Public License version 2 or later
*
* /!\  Joomla! is free software.
* This version may have been modified pursuant to the GNU General Public License,
* and as distributed it includes or is derivative of works licensed under the
* GNU General Public License or other free or open source software licenses.
*
*             .oooO  Oooo.     See COPYRIGHT.php for copyright notices and details.
*             (   )  (   )
* -------------\ (----) /----------------------------------------------------------- +
*               \_)  (_/
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

@define("JPATH_ADMIN_FRANCHISERS", JPATH_ADMINISTRATOR .DS. 'components' .DS. 'com_franchisers');
if (!class_exists('FranchisersJFormField'))
	require_once(JPATH_ADMIN_FRANCHISERS .DS. 'classes' .DS. 'formfield.php');


/**
* Form field for Franchisers.
*
* @package	Franchisers
* @subpackage	Form
*/
class JFormFieldCkcombo extends FranchisersJFormField
{
	/**
	* The form field type.
	*
	* @var string
	*/
	public $type = 'ckcombo';

	/**
	* Method to get the field input markup.
	*
	* @access	public
	*
	* @return	string	The field input markup.
	*
	* @since	11.1
	*/
	public function getInput()
	{
		$options = array();
		if (!isset($this->jdomOptions['list']))
		{
			//Get the options
			foreach ($this->element->children() as $option)
			{
				$opt = new stdClass();
				$opt->id = (string)$option['value'];
				$opt->text = JText::_(trim((string) $option));
				$options[] = $opt;
			}
		}
		$this->input = JDom::_('html.form.input.select', array_merge(array(
				'dataKey' => $this->getOption('name'),
				'dataValue' => $this->value,
				'domClass' => (isset($this->element['class'])?$this->element['class']:null),
				'formControl' => $this->formControl,
				'listKey' => $this->getOption('listKey'),
				'labelKey' => $this->getOption('labelKey'),
				'nullLabel' => $this->getOption('nullLabel'),
				'size' => $this->getOption('size', 1, 'int'),
				'list' => $options
			), $this->jdomOptions));

		return parent::getInput();
	}


}

Regards,

GC
The administrator has disabled public write access.

Re: Custom Selectlist 25 Oct 2012 11:23 #4735

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
In JDom :


dom/html/form/input/select/combo.php

If I remember well.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.062 seconds

Get Started