TOPIC:

populate a fieldlist with joomla articles title 2 years 7 months ago #233908

  • netenvie's Avatar Topic Author
  • netenvie
  • Offline
  • Senior Breezer
  • Senior Breezer
  • If you fail, try again and fail better !
  • Posts: 142
  • Thanks: 5
Hi,
As said in title i want a form field (list) and i need to populate (fill) list with all articles title from a specified Joomla category.
IS there a way to do that please ?

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

populate a fieldlist with joomla articles title 2 years 7 months ago #233932

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

I have answered on the ticket that you have created so please take a look at the answer there.

Regards,

Mihaela

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

populate a fieldlist with joomla articles title 2 years 5 months ago #234930

  • greg.o
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 49
  • Thanks: 0
Hello,

I am also very interested in this process. Can you communicate it to me?

Thank you!

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

populate a fieldlist with joomla articles title 2 years 5 months ago #234931

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Hello,

You can try to fill in select list putting the following code in Before Form pieces as explained in this piece of documentation crosstec.org/en/support/online-documenta...ct-list-from-db.html .
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();
$db->setQuery('Select title From #__content Where catid=2 OR catid=3'); 
 
$result = $db->loadColumn(); //load the result from the query
$test = "";
for ($i = 0; $i < count($result); $i++)
{
     $test .= "0;".$result[$i].";".$result[$i]."\n";
}
 
function ff_setSelectList($name, $value)
{
     global $ff_processor;
     for ($r = 0; $r < $ff_processor->rowcount; $r++)
     {
          $row =& $ff_processor->rows[$r];
          if ($row->name==$name)
          $row->data2 = $value;
          unset($row);
     } // for
} // ff_setSelectList
ff_setSelectList('fieldname', $test);
NOTE: Make sure to replace fieldname with the name of the form select list element that you wish to fill in with possible options.

This code will take all articles with "catid" equal to 2 or 3.

Let me know whether this helped to achieve what you want.

Regards,

Mihaela
The following user(s) said Thank You: greg.o

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

populate a fieldlist with joomla articles title 2 years 5 months ago #234932

  • netenvie's Avatar Topic Author
  • netenvie
  • Offline
  • Senior Breezer
  • Senior Breezer
  • If you fail, try again and fail better !
  • Posts: 142
  • Thanks: 5
Hello,
Go to form advanced properties -> more options
Then go to form pieces and paste that in before form :
$this->execPieceByName('ff_InitLib');
$db = JFactory::getDBO();

// Customize this sql request :
$db->setQuery('Select title From #__content Where catid=1 OR catid=2 order by title'); 
 
$result = $db->loadColumn(); //load the result from the query
$selectlistv = "";

// Customize choice text :
$selectlistv .= "0;Choose something ...;choixf\n";
for ($i = 0; $i < count($result); $i++)
{
     $selectlistv .= "0;".$result[$i].";".$result[$i]."\n";
}
function ff_setSelectList($name, $value)
{
     global $ff_processor;
     for ($r = 0; $r < $ff_processor->rowcount; $r++)
     {
          $row =& $ff_processor->rows[$r];
          if ($row->name==$name)
          $row->data2 = $value;
          unset($row);
     } // for
} // ff_setSelectList

// Customize yourfieldname
ff_setSelectList('yourfieldname', $selectlistv);
The following user(s) said Thank You: greg.o, mihaela

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

Last edit: Post by netenvie.

populate a fieldlist with joomla articles title 2 years 5 months ago #234933

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 415
Dear "Netenvie",

thank you for sharing, I have just suggested the same to the user.

Best regards,

Mihaela
The following user(s) said Thank You: greg.o

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

Moderators: ForumSupport
Time to create page: 0.241 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!