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.077 seconds
Great UX great performance and definitely a time saver. It only took me 10 minutes of playing around before purchasing a subscription and right now I just want to throw more money at you! I just started a new project and after just 4h I can already tell it probably saved me several days of work. I'm building a wholesale ordering system with sales rep management. I have not looked at the code yet but so far: impressive.
flip (Forum)

Get Started