TOPIC:

Selectlist value not getting saved 3 years 1 month ago #221067

  • Topic Author
  • suthzy
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 1
I have the same exact problem as crosstec.org/en/forums/3-breezingforms-f...-save-the-value.html


Can you provide the solution please as the solution was not provided in the link above.

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

Selectlist value not getting saved 3 years 4 weeks ago #221109

  • JulianGracin's Avatar
  • JulianGracin
  • Offline
  • Developer
  • Developer
  • Posts: 673
  • Karma: 33
  • Thanks: 66
Hi,

Can you describe you problem a bit better? A link to an old topic won't help a lot.

Are you using Breezing Forms only or have you integrated it with Content Builder? Is only the Select list that is being populated from the database not being saved?
Please include as much details about your issue as possible.


Regards,
Julian
=========================================
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!

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

Selectlist value not getting saved 3 years 4 weeks ago #221124

  • Topic Author
  • suthzy
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 1
Hi,

Actually what is being described in the link is my problem.

Yes, I am using breezingforms integrated with content builder. Yes, only the select list populated from the database is not being saved. Below is the php code piece i have on the Before Form advance setting of the form for populating the select list from the database.

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

//set the sql query string
$sqlStr = "select concat(rs1.value,' *** ',rs2.value) value, rs1.record id from
(select record,value from z25yx_facileforms_subrecords WHERE element='308') rs1
left outer join
(select record,value from z25yx_facileforms_subrecords WHERE element='309') rs2
on rs1.record = rs2.record";

$db->setQuery($sqlStr);

$rowlist = $db->loadRowList(); //load the result from the query

$selectStr .= "1;--- Choose Job --- ;\n";

//populate the select string
for ($row = 0; $row < count($rowlist ); $row++)
{
$selectStr .= "0;".$rowlist[$row][0].";".$rowlist[$row][1]."\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('job', $selectStr);
The following user(s) said Thank You: daduts

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

Selectlist value not getting saved 3 years 4 weeks ago #221146

  • JulianGracin's Avatar
  • JulianGracin
  • Offline
  • Developer
  • Developer
  • Posts: 673
  • Karma: 33
  • Thanks: 66
Hi,

Thanks for clarifying your situation. It's easier to pinpoint the issue with enough information.

Since you are using Content Builder, with or without Breezing Forms integration, Select Lists that are created using query from db or using only javascript to add options, will not be stored in the database. This is how Content Builder was intended to work.

You could work around this by creating a php script for saving the data of the select list that wasn't saved in the database.


Regards,
Julian
=========================================
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!

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

Selectlist value not getting saved 3 years 4 weeks ago #221192

  • Topic Author
  • suthzy
  • Offline
  • Junior Breezer
  • Junior Breezer
  • Posts: 77
  • Thanks: 1
How and where do I create a php script to save data of the select list into the database?

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

Selectlist value not getting saved 3 years 4 weeks ago #221250

  • JulianGracin's Avatar
  • JulianGracin
  • Offline
  • Developer
  • Developer
  • Posts: 673
  • Karma: 33
  • Thanks: 66
Hi,

You could try using this piece of code in the Form -> Advanced -> More Options -> Submit Pieces -> After Submit. Click on Custom and paste in the code below:
$this->execPieceByName('ff_InitLib');

if ( ( $recId = JRequest::getVar('record_id') ) != '' ) {
  ff_updateCustom($this->submitdata, 'Your_Select_List_Element_Name', $recId);
}
// This function will take care of updating the #__facileforms_subrecords table with the proper values
// - for $submits  passing $this->submitdata
// - for $elementName  pass in the name of the element whose value you wish to update
// - $recId takes the record id of the element beign edited. If it is not set, it a new record and there is nothing update in the table
function ff_updateCustom($submits, $elementName, $recId) {
  foreach ($submits as $sub) {
    if ($sub[1] == $elementName) {

      $inputName = $sub[1];
      $inputValue = $sub[4];

      $db = JFactory::getDBO();
      $db->setQuery("Select id from #__facileforms_subrecords Where name = '$inputName' And record = $recId ");
      if ($db->loadResult()) {
        $db->setQuery("Update #__facileforms_subrecords Set value = '$inputValue' Where name = '$inputName' And record = $recId ");
      } else {
        $inputElement = $sub[0];
        $inputTitle = $sub[2];
        $inputType = $sub[3];

        $db->setQuery("Insert into #__facileforms_subrecords ( record, element, title, name, type, value ) values ( $recId, $inputElement, '$inputTitle', '$inputName', '$inputType', '$inputValue' ) ");
      }
      $db->query();
    }
  }
}

To get this to work you need to replace the Your_Select_List_Element_Name with the name of your select list:
ff_updateCustom($this->submitdata, 'Your_Select_List_Element_Name', $recId);

You can use the same line as above for each select list you need to save in the database. Just copy the line and replace the Your_Select_List_Element_Name with the name of your other list.

NOTE: this piece of code will not work if you are using plain Content Builder with Data Storage. It only works if you have Breezing Forms integrated with Content Builder.

Try it out and let me know if it works.


Regards,
Julian
=========================================
Need to renew Pro Support?
Buy Here!
=========================================
Satisfied?
Consider a membership!
=========================================
Like us on Facebook
=========================================
Support Crosstec and get ALL EXTENSIONS and professional support for just $5
Here!
The following user(s) said Thank You: suthzy

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.052 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!