Form email plugin - pass data to form

joit

Active Member
Hi,

if a user is in detail view of a record, he should be able to contact the creator of the record. I did this by passing contact details to the contact form as proposed here:
Pass a value to another form | Fabrik
It works but I'd also like to include the records elements in the email. Now if I pass them the same way as contact details I need a lot of duplicates of elements (because I need to have them in the contact form, too). Is there a nicer way? Maybe with the article template?

Thanks!
 
You'd probably have to use a PHP template, and write a few lines of code to grab the row you need from the related record.

Unless you want to venture in to the land of PHP template coding, you might just want to go the route of passing the info in on the query string and duplicating the records.

Or I can give you some hints on how to write the template. I'll need to know the exact element names involved.

-- hugh
 
"Or I can give you some hints on how to write the template"
Sounds like a plan! These are the elements I need for sure:
angebot___benutzer
angebot___startdatum
angebot___haeufigkeit
angebot___Start
angebot___Ziel
 
So 'angebot' is the "other" table, yes? What are some example element names from "this" form (the one the email plugin is on)? I'll need to know at least the FK value for angebot, i.e. the element on "this" form that has the PK (rowid) of the 'angebot' row you need to grab.

-- hugh
 
'angebot' is the "original" table, where the records get stored by the users.
the email plugin is on the form 'kontaktformular', an example element name would be "kontaktformular___nachricht" or "___nachricht" if I don't store the records.
I'm not really sure how I can get FK and PK. In Fabrik, the ID for form 'kontaktformular' is 26. The Fabrik ID of element "kontaktformular___nachricht" is 139.
In phpMyadmin, the IDs for my elements are:
angebot___benutzer 27
angebot___startdatum 4
angebot___haeufigkeit 25
angebot___Start 22
angebot___Ziel 23

Does this help?
 
Ah OK. So, in order for this to work, where you do this:

passing contact details to the contact form

... you'll need to pass in the rowid of the 'angebot' row to your 'kontaktformular', rather than (or as well as) any other specific 'angebot' element value you are currently passing in, which I presume is the email?

So create an "FK" element on the contact form, as a simple field element set to "Integer", hidden, called something like angebot_id, which you then pre-fill by adding &kontaktformular___angebot_id={rowid}, or &kontaktformular___angebot_id={angebot___id}, depending on how / where you are building that custom link to the contact form.

Once we have that angebot_id being submitted with the contact form, we can do the scripting in the email plugin on the contact form to pull that row from angebot, and insert the contact details into the template.

So get that bit going, and let me know.

-- hugh
 
ok, I created the FK element.
I have a link element on my angebot list that links to kontaktformular
How can I prefill the FK element, I mean how do I use that code:
&kontaktformular___angebot_id={rowid}, or &kontaktformular___angebot_id={angebot___id}
 
How can I prefill the FK element, I mean how do I use that code:
&kontaktformular___angebot_id={rowid}, or &kontaktformular___angebot_id={angebot___id}

If as per that first thread you quoted you are using a custom URL then that would be part of the URL, so say your contact form's url is:

Code:
http://site.com/index.php?option=com_fabrik&view=form&formid=1
then you would alter that to

Code:
http://site.com/contact?option=com_fabrik&view=form&formid=1&kontaktformular___angebot_id={rowid}
 
OK,

I've got it kind of working for all elements except for the date plugin. It works with user, dropdown and field plugin. Maybe there is a bug with the date plugin? Or do I have to treat it differently?
 
what is the exact url that you are using? It could well be the format of the date that needs changing.
 
After I ripped my hair out getting it to work I decided to duplicate the elements as described in the first post. This is the link I use:
index.php?option=com_fabrik&view=form&formid=26&___kontaktname={angebot___benutzer}&___kontaktemail={angebot___benutzermail}&___startdatum={angebot___startdatum}&___haeufigkeit= {angebot___haeufigkeit}&___Start={angebot___Start}&___Ziel={angebot___Ziel}
 
I'm now confused. Are you not using the FK method I described above?

I think you'll need to find me or Rob on LiveZilla or Skype, and walk us through what you are doing while we look at your site.

-- hugh
 
Yes, I don't use the FK element. I decided that duplicating the elements is not so bad.
 
ok after a log discusson with joit, it seems there's a very very deep seated bug with how placeholders interact with encrypted data, that is passes around in arrays (such as the date element) and when and how the link element works with placeholders.

I've suggested to use a calculation element which seems to work :

Code:
[SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana]return <a href="[SIZE=2][FONT=Verdana]index.php?option=com_fabrik&view=form&formid=26&___kontaktname={angebot___benutzer}&___kontaktemail={angebot___benutzermail}&___startdatum={angebot___startdatum_raw}&___haeufigkeit= {angebot___haeufigkeit}&___Start={angebot___Start}&___Ziel={angebot___Ziel}[/FONT][/SIZE]">[SIZE=2][FONT=Verdana]Nachricht schicken</a>';[/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE]
[SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana][SIZE=2][FONT=Verdana]
[/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE][/FONT][/SIZE]
 
sorry my copy and paste got messed up:

set this as the content in the 'calculation' field:
Code:
return <a href="index.php?option=com_fabrik&view=form&formid=26&___kontaktname={angebot___benutzer}&___kontaktemail={angebot___benutzermail}&___startdatum={angebot___startdatum_raw}&___haeufigkeit= {angebot___haeufigkeit}&___Start={angebot___Start}&___Ziel={angebot___Ziel}">Nachricht schicken</a>';
 
Thanks, this works perfectly for the date plugin!
But it seems that the calc plugin interprets the user plugin differently. Nothing is inserted in the user name (___kontaktname) and user email (___kontaktemail) plugins.
This is the URL generated by the link plugin:
http://www.beiladen.com/130118/index.php/de/fahrt/form/26?___kontaktname=912&___kontaktemail=912&___startdatum=2013-05-15 14:47:00,14:47&___haeufigkeit= einmalig&___Start=345&___Ziel=567
This is the URL generated by the calc plugin:
http://www.beiladen.com/130118/index.php/de/fahrt/form/26?___kontaktname=test&___kontaktemail=joitdee@gmail.com&___startdatum=2013-05-15 14:47:00&___haeufigkeit= einmalig&___Start=345&___Ziel=567

I tried with the _raw extension but no success.
Do you have an idea?
 
Sorry I'm getting confused again as to your set up :(


If your first form uses user elements, then the user id is passed using the following for the calculation element:

Code:
return '<a href="index.php?___kontaktname={angebot___benutzermail_raw}">link</a>';

Code:
index.php?___kontaktname=62
 
This is what I use for the calc element:
return <a href="index.php?option=com_fabrik&view=form&formid=26&___kontaktname={angebot___benutzer_raw}&___kontaktemail={angebot___benutzermail_raw}&___startdatum={angebot___startdatum_raw}&___haeufigkeit= {angebot___haeufigkeit}&___Start={angebot___Start}&___Ziel={angebot___Ziel}">Nachricht schicken</a>';
But the user name and email plugin doesn't get filled out (see attachment)
 

Attachments

  • user.png
    user.png
    13.7 KB · Views: 373
you would need to add a single quote after return. That was my fault I incorrectly wrote it in post #16

The admin login you provided in my-sites no longer allows me to log in, could you fix that and I will try to look at what the issue is. Also can you confirm the form that contains the link element and the name of the element you want to add the link to, there seems to be several different test links now :)

-Rob
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top