Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Custom Selectlist 25 Oct 2012 08:05 #4732

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

Please Log in or Create an account to join the conversation.

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

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


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

If I remember well.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.070 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started