1. Pascal Wickert
  2. Sherlock Holmes The Voice
  3. General Talk
  4. Tuesday, 20 February 2018
  5.  Subscribe via email
Hello Yves,

long time no see. Our installation of Matukio 6.1.5 is working well. I did not yet upgrade to version 7 but I should do it this summer when the registration are lower than now.

I am trying, using RSForm pro, to populate a dropdown list field with a list of our current events. I am able to display all the events but not only the currents one. Here is the php code I used in the specific field within a RSForm Pro form :



//<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 title FROM #__matukio");
$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->title;
$label = $result->title;
$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>



Ref.: https://www.rsjoomla.com/support/documentation/rsform-pro/custom-scripting/how-to-store-the-submission-in-a-file-and-send-it-through-the-email.html

As you can see I am not a developper and I have taken their example code that I tweak a bit with Matukio database information. Could you help me to refine the query for the field to show only current event titles?

Thank you so much,

Pascal
Responses (1)


There are %s replies to this question. If you want to see them you need a valid subscription.
If you have a valid subscription, please login now.
Visit store now
Powered by EasyDiscuss for Joomla!