Populate select list from joomla frontend.

  • pjfroelofs
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 0

pjfroelofs replied the topic: Populate select list from joomla frontend.

Mihaela,

that is exactly what happens.
This is my before form code:

$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object

$db->setQuery("SELECT value from #__facileforms_subrecords WHERE element = 2829 ORDER BY id DESC");
$test = $db->loadResult();

$opts = "0;Kies persoon;Kies persoon\n";

foreach(preg_split("/((\r?\n)|(\r\n?))/", $test) as $line){
// $output = "";
// $output = getBetween($line, ';', ';');
$opts.= "0;". $line.";". $line."\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('Naambewoner', $opts);
#233295
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: Populate select list from joomla frontend.

Hello,

Could you please send me your backend credentials to mihaela.kobovac@crosstec.org so I can take a look at this form?
In the email please write the name of the form that I should look at.

Regards,

Mihaela
#233299
  • pjfroelofs
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 0

pjfroelofs replied the topic: Populate select list from joomla frontend.

Mihaela,
I saw you had a look at my problem.
Do you have any suggestions? Did I make any mistakes?

Regards,
Patrick
#233432
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: Populate select list from joomla frontend.

Hello,

After looking deeper into this and more testing I've discovered that this approach only works when filling in form through BreezingForms only.
For example, I've selected the name "Anna" in the select list element when I previewed the form "Vochtbalans2" in the backend and I see that the name is saved to record of this form submission.
When I did the same thing but through ContentBuilder View the name wasn't saved.

Therefore I suggest that you try different approach regarding filling in this select list with names.
Try to do as follows:

1) Delete the code from before form pieces in form containing select list Naambewoner.

2) Go to Advanced properties of the form that contains textarea element > More options > Submit pieces and in End Submit section set Type to Custom.
In the code area below put the following code:
$this->execPieceByName('ff_InitLib'); //Include BreezingForms Library
$db = JFactory::getDBO();//Get Database Object

$test = ff_getSubmit('textareaname');
$test = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $test);

$opts = "0;Pick a Campaign;\n";
foreach(preg_split("/((\r?\n)|(\r\n?))/", $test) as $line){
    $opts.= "0;". $line .";". $line ."\n";
} 

$db->setQuery("UPDATE #__facileforms_elements SET data2 = '$opts' WHERE id = 2119"); 
$db->execute();
NOTE: In the code above replace textareaname with the Name of the textarea element. Also, replace 2119 with the ID of the select list element in the other form.

Let me know whether select list was properly filled with options form textarea and whether with this approach it works when adding record through a list view.

Regards,

Mihaela
#233465
  • pjfroelofs
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 45
  • Thank you received: 0

pjfroelofs replied the topic: Populate select list from joomla frontend.

Michaela,
This code in (submit pieces -> End submit) results in an form, where no select list is visible.
See attachment.

Please advice,
Patrick
#233545
Attachments:
  • Posts: 2461
  • Karma: 86
  • Thank you received: 333

mihaela replied the topic: Populate select list from joomla frontend.

Hello,

Since you've sent me backedn login info before I took a look at your form so find why it is not working.

When looking at the End Submit piece code I've realized that in this line of code:
$test = ff_getSubmit('Naambewoner');
Naambewoner is the name of select list and not the textarea element.
As explained in my previous post, you should put the textarea name there.

Furthermore, I saw another error in your code. In this line of code:
$db->setQuery("UPDATE #__facileforms_elements SET data2 = '$opts' WHERE id = 2829");
it seems that 2829 isn't the id of the select list. When I've inspected the element I saw that 2469 is the ID of that select list.

The whole code should be put in End Submit Pieces of the form that contains the textarea element from which the select list should be filled and not the form that contains the select list.

Please make the changes as explained and let me know whether it worked.

Regards,

Mihaela
#233559
Moderators: ForumSupporttomeperica
Time to create page: 0.073 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

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!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here