Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] JDOM: Missing listOptions on radio control

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

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
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;
Last Edit: 02 Oct 2013 16:10 by Tomaselli.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

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

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

K++
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: Tomaselli
Time to create page: 0.057 seconds

Get Started