× Form Help

Get data from different form entry

  • Leni14
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 48
  • Thank you received: 0

Leni14 created the topic: Get data from different form entry

Hi,

I do not understand how I could get data in fields from fields of a different form. I saw a thread dealing with this but I did not understand a word :-D Someone out there who could explane for dummies?

BTW I named the field identical in both forms.

Best,
Leni
#238959
  • Posts: 2986
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Get data from different form entry

Hello,

Is the user being redirected from one form to another so the value can be passed as URL parameter or should this just be looked up in the database?

Based on which createria should the data from database be taken?
I assume that you want to get value which was submitted by that same user, but in another form.

Regards,

Mihaela
#238981
  • Leni14
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 48
  • Thank you received: 0

Leni14 replied the topic: Get data from different form entry

I assume that you want to get value which was submitted by that same user, but in another form.


correct. I want the user to have "standard data" entry in one form which is used always when the generate data in the second form.

e.g. In Stadard form they would select that they calculate VAT, so I don't want them to have to enter this information everytime they use the second form (although this is necessary for the form).
#238985
  • Posts: 2986
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Get data from different form entry

Hello,

I understand now how you want this to work.

To achieve what you want, do as follows.

Go to your form's Advanced properties > More options > Form pieces and in the Before Form section set Type to Custom.

Then in the code area that appears put the following code:
$this->execPieceByName('ff_InitLib'); 

$user = JFactory::getUser();

// Get record ID of logged in user's submission of the 'standard' form
$db = JFactory::getDbo();
$db->setQuery('SELECT id FROM #__facileforms_records WHERE user_id ="'.$user->id.'" AND form = 7');
$recid = $db->loadResult();

// get data from specific field submitted in that record
$db2 = JFactory::getDbo();
$db2 ->setQuery('SELECT value from #__facileforms_subrecords WHERE element = 13627 AND record ="'.$recid.'"');
$result = $db2->loadResult();

//fill field in second form with the result
ff_setValue('fillFieldName',$result);
NOTE: In the code above you have to replace 7 with the ID of the "standard data" entry form. You can get the ID by going to BreezingForms > Manage Records from the "Script ID" column.
Next, replace 13627 with the "element" number of the field from which you wish to take the value from #_facileforms_subrecords database table.
Finally, replace fillFieldName with the actual name of the field in the second form that you wish to fill in.

Let me know whether you have managed to apply this to your form and whether this is working as you wanted.

Regards,

Mihaela
#239005
  • Leni14
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 48
  • Thank you received: 0

Leni14 replied the topic: Get data from different form entry

Hi Mihaela,

thank you so much for your quick replies. I really appreciate this very much.

The code works partially.

It get's data in the correct field but not the correct value. With

Next, replace 13627 with the "element" number of the field from which you wish to take the value from #_facileforms_subrecords database table.

you mean the element number in the database correct?

I attached the database snippet.

So in my case I want to show value of Bank which would be element 21. But if I set 21 in the code the field remains empty. If I set ID which is 279, it shows BIC value instead. So I though I should show 281 :-) and tried this too. But then no value is shown again - which is really strange.
#239012
  • Leni14
  • Topic Author
  • Offline
  • Senior Boarder
  • Senior Boarder
  • Posts: 48
  • Thank you received: 0

Leni14 replied the topic: Get data from different form entry

and here is the attachment :-D
#239014
Attachments:
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