Support

  1. Mafketel
  2. General
  3. Wednesday, April 16 2014, 02:42 PM
Hi,
I would like to be able to fill the values for a dropdown select with values froma database. Is this possible?
Accepted Answer
admin Accepted Answer
Admin
Hi,
for now not, this feature is in our TODO list!

if you can wait I will implement this feature on next release (some days),
else you can replace the function getOptions() in file /administrator/components/com_jsn/models/fields/selectlist.php with this:
public function getOptions()
{
$alias=$this->element['name'];

if($alias=='alias_of_field') // set the alias of your field (width this conditions the select type work normally for all field except for this field)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('a.id AS value, a.title AS text') // set db column for value and text (in this example id => value and title => text)
->from('#__content AS a'); // set db table (in this example the table is #__content , this table contains all articles of your site)
->where('state="1"'); // set where where of query (in this example we filter only published aticles)
$db->setQuery($query);

try
{
$options = $db->loadObjectList();
}
catch (RuntimeException $e)
{
return false;
}

$options = array_merge(parent::getOptions(), $options); // Merge any additional options in the fields params (you can remove this).

return $options;
}
else
{
return parent::getOptions();
}
}

Follow the commented instruction for build your query.
  1. more than a month ago
  2. General
  3. # Permalink
Mafketel Accepted Answer
I can work with the code for now. I will probably have some questions/suggestions in the next couple of days, since I am just staarting to use the component.

For now: Thanx for the quick and helpful response.
  1. more than a month ago
  2. General
  3. # 1
krnsgrffn Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 2
admin Accepted Answer
Admin
Is this feature implemented yet?
Yes
There are fields available to fill out on the admin side, but they do not seem to be editable. I am using EasyProfile Basic 1.3.2.
see screenshot;)
Attachments (1)
  1. more than a month ago
  2. General
  3. # 3
krnsgrffn Accepted Answer
Pro
Content Protected
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
The default order is already alphabetical. (see line 77 of file /administrator/components/com_jsn/models/fields/selectlist.php).

The option are loaded by getOptions function in file /administrator/components/com_jsn/models/fields/selectlist.php
Other behaviour are in /administrator/components/com_jsn/helpers/fields/selectlist.php
The option XML is in /administrator/components/com_jsn/helpers/fields/selectlist.xml
  1. more than a month ago
  2. General
  3. # 5
krnsgrffn Accepted Answer
Pro
Thanks much!
  1. more than a month ago
  2. General
  3. # 6
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.