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

TOPIC:

JDOM: Missing listOptions on radio control 02 Oct 2013 16:07 #11277

An example would make easier to understand what the problem is.
The following is just an example.

When passing this as $options:
$options = array();
$options["1"] = array("value" => "1", "text" => JText::_("ENUM_DAY_MONDAY"));
$options["2"] = array("value" => "2", "text" => JText::_("ENUM_DAY_TUESDAY"));
$options["3"] = array("value" => "3", "text" => JText::_("ENUM_DAY_WEDNESDAY"));
$options["4"] = array("value" => "4", "text" => JText::_("ENUM_DAY_THURSDAY"));
$options["5"] = array("value" => "5", "text" => JText::_("ENUM_DAY_FRIDAY"));
$options["6"] = array("value" => "6", "text" => JText::_("ENUM_DAY_SATURDAY"));
$options["7"] = array("value" => "7", "text" => JText::_("ENUM_DAY_SUNDAY"));

to this:
		$jdomOptions = array_merge(array(
				'dataKey' => $this->getOption('name'),
				'domClass' => $this->getOption('class'),
				'domId' => $this->id,
				'domName' => $this->name,
				'dataValue' => (string)$this->value,
				'labelKey' => $this->getOption('labelKey'),
				'list' => $options,
				'listKey' => $this->getOption('listKey'),
				'nullLabel' => $this->getOption('nullLabel'),
				'responsive' => $this->getOption('responsive'),
				'submitEventName' => ($this->getOption('submit') == 'true'?'onclick':null),
				'viewType' => $this->getOption('viewType')
			), $this->jdomOptions);
		
		$this->input = JDom::_('html.form.input.radio', $jdomOptions);

the JDOM doesn't read the list, and the render has options with no attributes, because it's expecting an OBJECT and we are passing an ARRAY.

FIX
add the following code to the line 78 of the file dom\html\form\input\select\radio.php
$item = (object)$item;
The following user(s) said Thank You: admin

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

Last edit: by Tomaselli.

JDOM: Missing listOptions on radio control 07 Oct 2013 00:16 #11301

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Fixed.

K++
Coding is now a piece of cake
The following user(s) said Thank You: Tomaselli

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

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

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started