--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-cms/-/uTAVGTtZsGwJ.
To post to this group, send an email to joomla-...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-cm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-cms?hl=en-GB.
Hi FrancescoYou probably want this: http://docs.joomla.org/JFormFieldList/1.6.Take a look in administrator/components/com_categories/models/fields/categoryparent.php for an example.
If extending the JFormFieldCombo you most likely just want to only implement the getOptions method and leave the getInput alone. So something like:class MyComboField extends JFormFieldCombo{public $type = 'MyCombo';protected function getOptions(){// Call db and build your options here:}}getInput will then call your getOptions and do it's magic.
--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
Well, there is nothing wrong with your code. Have just had a look through the JFormFieldCombo and the associated javascript and it appears to be broken. The javascript is looking for any select elements with a class of combobox which it will then customise, however the JFormFieldCombo code outputs a UL element instead.
You can fix this by changing your JFormFieldCombo::getInput to look like this:
protected function getInput(){// Initialize variables.$html = array();$attr = '';// Initialize some field attributes.$attr .= $this->element['class'] ? ' class="combobox '.(string) $this->element['class'].'"' : ' class="combobox"';$attr .= ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';// Initialize JavaScript field attributes.$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';// Get the field options.$options = $this->getOptions();// Load the combobox behavior.JHtml::_('behavior.combobox');// Build the list for the combo box.$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);return implode($html);}In essence I have just changed it to no longer output the text field and ul element and just render a select element. I have tested this an it works as expected.
--
Remove the size="5" attribute from your xml and you are good to go.
I think if no value exists that will appear to give the user a prompt for they should do.