TOPIC:

Populate select list from joomla frontend. 1 year 5 months ago #233295

  • Topic Author
  • pjfroelofs
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 50
  • Thanks: 0
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);

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

Populate select list from joomla frontend. 1 year 5 months ago #233299

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Populate select list from joomla frontend. 1 year 5 months ago #233432

  • Topic Author
  • pjfroelofs
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 50
  • Thanks: 0
Mihaela,
I saw you had a look at my problem.
Do you have any suggestions? Did I make any mistakes?

Regards,
Patrick

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

Populate select list from joomla frontend. 1 year 5 months ago #233465

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Populate select list from joomla frontend. 1 year 5 months ago #233545

  • Topic Author
  • pjfroelofs
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 50
  • Thanks: 0
Michaela,
This code in (submit pieces -> End submit) results in an form, where no select list is visible.
See attachment.

Please advice,
Patrick
Attachments:

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

Populate select list from joomla frontend. 1 year 5 months ago #233559

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 413
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

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

Moderators: ForumSupport
Time to create page: 0.044 seconds

Summer Sale!

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!