Send email when form fullfilled with advanced option.

Hi,
I have Joomla 2.5.6 + Fabrik on GitHub 3.0.5.-947-g76c7736.

I try to use some more advanced option to send email to choosen recipient when form is fullfiled.

I can do something what is not satisfied for me:

I have form "Internal orders" and when that form is fullfilled and clicked button "Send" than email message to choosen "Recipient" should be send.
I have in form "Internal order" an element "Recipient" that is :
Plugin - databasejoin
Render join as - Drop-down
Connection - database myjoomla
Table: myjoomla_users
Value - id
Label: email

In that case email is send to choosen Recipient but problem is that i use :
myjoomla_users + field "email" what is inconvenient because of problem with knowledge who has that email.

I would like something more advanced:

My table myjoomla_users has fields like:
name ---- for example John Green
email ---- jg@mycompany.eu
............

I would like in Form to chose from drop-down "Recipient" as myjoomla_users field: name
Value - id
Label: name
so i know who is John Grey
and email should be send to email adress in John Grey record in myjoomla_users table - so Fabrik should know to send email message to email value that is stored in my_joomla_users field: email for John Grey.

I am not sure what is recommended/professional way for Fabrik to set it up?
Can you give me directions how to do it?

I think about to use autofill plugin but I am not sure if it is good way?
 
Thanks,
but this code looks to complicated to me:
I try in "myjoomla_xx_zap" form that code:
Code:
$db =& JFactory::getDBO();
$query = "SELECT 'email' FROM 'myjoomla_users' WHERE "id" = {myjoomla_users___name_raw}";$db->setQuery($query);
$result = $db->loadResult();return $result;

I work with "myjoomla_xx_zap" table/form
and I make databasejoin to "myjoomla_users" table that has fields (in real mysql):
id
email ----> it is jg@mycompany.eu
name ----> it is my John Green

It doesn't work - I don't received any email - on John Green email box.
What with my code can be not properly or what else can cause that I don't get an email to John Green ?
 
Hi,

I used few days to find solution how to send email with option Email to (eval) and I can't.

I don't know if something in my code is wrong or it is a Fabrik bug?

Can youn tell me it?

I tried others way:
Code:
$db =& JFactory::getDBO();
$query = "SELECT {myjoomla_users___email} FROM {myjoomla_users} WHERE {myjoomla_users___id} = {myjoomla_users___name_raw}";
$db->setQuery($query);$result = $db->loadResult();
return $result;
My form use table and element: {myjoomla-xx-zap___recipient}
and that is a database join to table myjoomla_users that has elements/fields:
{myjoomla_users___id}
{myjoomla_users___name}
{myjoomla_users___email}

(That database join choose: myjoomla_users, value: id, label:name )

I have no exerience with php coding in Fabrik and I don't know what really should be in/or instead of:
{myjoomla_users___name_raw}

What is _raw ?

What is wrong with my code or code is OK and I should look something others bug or something else?

???
 
Try this...


Code:
$db =& JFactory::getDBO();
$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = '{myjoomla_xx_zap___recipient_raw}'";
$db->setQuery($query);
$result = $db->loadResult();
return $result;


What is _raw


Raw is the value that is stored by Fabrik. So for example 'myjoomla_xx_zap___recipient' may have the name of Joe Bloggs when you use the database join. However the value maybe 4 which would be the id number is the myjoomla_users table.


So the myjoomla_users table may have the following as a record.


id = 4
Name - Joe Bloggs
Email - joebloggs@fabriking.com


So the query above is saying get me the email field from the myjoomla_users table where the ID = 4. It gets the as that is what myjoomla_xx_zap___recipient_raw equals to.

Hope that that makes more sense.
 
Thanks Felixkat - but that doesn't work for me. I tried that code earlier and now once again.
After saving form i have standard message "record added" and nothing about email sending.
But i don't receive any email - I was trying several different recipients and emails addresses.

I tried other plug-in: autofill and it doesn't work for me too. May be it is any bug?
I have no idea what could i set up else?
 
Try this:

PHP:
$db =& JFactory::getDBO();
$recipient = '{myjoomla_xx_zap___recipient_raw}';
var_dump($recipient);
$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = " . $db->Quote($recipient);
var_dump($query);exit;
$db->setQuery($query);
$result = $db->loadResult();
return $result;

This should output some debugging information to your browser, and exit processing, so all you'll see in your browser will be the debug info.

Copy and paste the debug output here.

-- hugh
 
Code:
string(49) "{myjoomla_xx_zap___recipient _raw}" string(98) "SELECT `email` FROM `myjoomla_users` WHERE `id` = '{myjoomla_xx_zap___recipient _raw}'"

I try some change in: ---- " ----- character,:

"SELECT `email` FROM `myjoomla_users` WHERE `id` = " . $db->Quote($recipient)""
In that case there is no message, but i don't receive any email too:
Code:
$db =& JFactory::getDBO();$recipient = '{myjoomla_xx_zap___recipient _raw}';var_dump($recipient);$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = " . $db->Quote($recipient)"";var_dump($query);exit;$db->setQuery($query);$result = $db->loadResult();return $result;
 
string(49) "{myjoomla_xx_zap___recipient _raw}"
So $recipient contains this string -> placeholder is not parsed.
There must be no space in your element name (before the _raw).
 
There's a space between myjoomla_xx_zap___recipient and _raw, must be myjoomla_xx_zap___recipient_raw
 
It is terrible, now return code is:

Code:
string(2) "48" string(51) "SELECT `email` FROM `myjoomla_users` WHERE `id` = '48'"

and email to (eval):

Code:
$db =& JFactory::getDBO();
$recipient = '{myjoomla_xx_zap___recipient_raw}';
var_dump($recipient);
$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = " . $db->Quote($recipient);
var_dump($query);exit;
$db->setQuery($query);
$result = $db->loadResult();
return $result;
 
Glad you got it working, not sure why Hugh's

Code:
$recipient = '{myjoomla_xx_zap___recipient_raw}';
$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = " . $db->Quote($recipient);

works for you and my...

Code:
$query = "SELECT `email` FROM `myjoomla_users` WHERE `id` = '{myjoomla_xx_zap___recipient_raw}'";

... didn't.

The second one worked for me on my server, I guess one of those unexplained things I'll never get an answer for. :)
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top