I'm try'n to create a custom form field of type text (or list) where a user can a) type free text and/or b) select from drop-down. Now I found many posts about autocomplete or auto-fill, but that's not what I'm after. I followed the example on how to create a 'City' Custom field here http://docs.joomla.org/J2.5:How_to_add_custom_filters_to_components and this is all working. However, it creates a drop-down only, no option to enter text.
I'm new to the Joomla (3.x) component development, so maybe I am missing something very simple here. With all those field types available, it's hard to belief there is no drop-down with free input.
So 1. can I make the default select/list to accept free text? 2. if not, can I get a pointer on how to get started making one my self? 3. For now, it would be fine to have ~10 city names listed, and free input, no need to filter the city list while typing. But ultimately, I would like to know on how to create a filter while typing Ajax version of this. (Like a suggest input-box)
This is what I use at the moment, the example as linked above I also tried extending Jformfield, with no luck
class JFormFieldCftCity extends JFormFieldList {
protected $type = 'CftCity';
public function getOptions() {
$options = array();
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('value As value, name As text');
$query->from('#__bitLuCity AS a');
$query->order('a.sortOrder');
$query->where('isEnabled = 1');
$db->setQuery($query);
$options = $db->loadObjectList();
return $options;
}
}
Thanks
Regards Andreas