Display item fields of one category as drop down <options> in RSForms

6 days 14 hours ago #77210 by tobajarrat
Hi at all!

What I try to achieve is:

A drop down field in RS forms, that displays FC values of one field as <option> of one specific category.

Maybe someone has a code template ready or at least could lead me to the solution.

Thank you in advance!!

Im using latest joomla and latest Flexicontent

Please Log in or Create an account to join the conversation.

6 days 13 hours ago #77211 by micker
hello maybe you can execute a sql query in rsform field ?

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

6 days 12 hours ago #77212 by tobajarrat
I found out, that I can place php code directly inside the "items" administrator drop down field.
So instead of hardcoding every "item" in backend, i can use php and sql query.

Example code is this:
//<code>
// Prepare the empty array
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you'd like a "Please select" option, otherwise comment or remove it
$items[] = "|Please Select[c]";
 
// Run the SQL query and store it in $results
$db->setQuery("SELECT your_value, your_label FROM #__your_table");
$results = $db->loadObjectList();
 
// Now, we need to convert the results into a readable RSForm! Pro format.
// The Items field will accept values in this format:
// value-to-be-stored|value-to-be-shown
// Eg. m|M-sized T-shirt
foreach ($results as $result) {
  $value = $result->your_value;
  $label = $result->your_label;
  $items[] = $value.'|'.$label;
}
 
// Multiple values are separated by new lines, so we need to do this now
$items = implode("\n", $items);
 
// Now we need to return the value to the field
return $items;
//</code>

But i don't know how to get my desired field, like category ID 8, field ID 13..

Im using latest joomla and latest Flexicontent

Please Log in or Create an account to join the conversation.

6 days 11 hours ago #77213 by micker
you need to check
$db->setQuery("SELECT your_value, your_label FROM #__your_table"); and db table in your site
#_flexicontent_fields (field description)
#_flexicontent_item_ext (relation joomla content id)
#_flexicontent_fields_item_relations (value in field in relation with item

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.