E-mail to selected user

SPABO 10 Oct, 2014
Hi Bob,
Would it be possible to send an e-mail to a selected user.

Something like : Ask the the teacher

A student chooses his teacher
Fills out a text area
And submit an e-mail to the e-mailaddress of this choosen teacher

The number of teachers and students are changing, so the name of the teacher and his corresponding e-mail should be extracted from the db I quess

I would appreciate if you could help me out
GreyHead 10 Oct, 2014
Hi SPABO,

Yes you can do that.

Use a DB Load/Read action to get the list of teachers and use the Dynamic Data tab in a Drop-down element to add them to a drop-down.

It isn't good practice to add the teacher emails in the form so you can look them up using a second DB Load/Read in the On Submit event and use the Email in the Dynamic To box of the Email action.

Bob
SPABO 10 Oct, 2014
Bob,
I put the DB Record Loader in the OnLoad event
I selected table jos2_users
And for the DB Field I put in: name

For the Preview area, in teh drop-down, I enabled Dynamic Data and at Value-key I put in "name"

Looking in the FE, it does give me the names

Where did I miss something?
GreyHead 10 Oct, 2014
Hi SPABO,

For the drop-down options you need a 'value' and a 'text'. Id use the ID and the name from the #__users table so the names show in the drop-down and the user ID is returned when the form is submitted.

Bob
SPABO 11 Oct, 2014
Pls find some pictures, but it still does not show any names 😢
SPABO 11 Oct, 2014
Bob, I followed a tut from the FAQ's, but is does not give results as well in the dropdown

Dynamic Data from a database table
You can use the ChronoForms DB Multi Record Loader action (or the DB Read action in CFv5) to create a data-set to use as your option list. You need to drag a copy of the action into the On Load event of your form and move it up before the Show HTML action. On the action General Tab you need to set at least the Table and Fields boxes (you may well need to complete others to select the records that you want to use).
For example, we might select the jos_content table and then add id,title in the Fields box. Note that the Model ID will default to josContent unless you set another value.
Save the action and go back on the Dynamic Data tab on the element. Enable the Dynamic Data; enter the Model ID josContent in the 'Model ID' box, then id in the 'value' box and title in the 'text' box.
Save the element and test the form, you should see a list of options that display the article titles as labels and return the matching article id when the form is submitted.
If you want to create a simple list where the value and label are the same you can just put title in both of the 'value' and 'text' boxes.

Max_admin 12 Oct, 2014
Hi,

In the "db loader" config, the "db field" should be empty, because you want to load all records!

You must enable the "load under model id", and enter a "model id", which you are going to use later in the "data path" field!

The fields names are case sensitive, so you need to use "id" but not "ID" if that's the field name in your table!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 12 Oct, 2014
Hi Max,
Sorry, but I cannot get it working, whatever I fill in etc
SPABO 12 Oct, 2014
It still gives an eeror:
Validation Errors:
Array
(
)
Max_admin 13 Oct, 2014
There are no errors, its an empty array!🙂

What do you have in the rest of the debug ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 13 Oct, 2014
Hi Max,
Here it is:

Array
(
[option] => com_chronoforms
[chronoform] => DOCENTEN
[Itemid] =>
)

GreyHead 13 Oct, 2014
Hi SPABO,

The empty Validation Errors array just means that no errors were found.

Please drag a Debugger action into the On Load event, then load the form and post the debug results here.

Bob
SPABO 13 Oct, 2014
Hi Bob,
See my reply abve, but here are the results again:

Data Array:

Array
(
[option] => com_chronoforms
[chronoform] => DOCENTEN
[Itemid] =>
)

Validation Errors:

Array
(
)


( There is nothing on the [itemid]=> part....)
GreyHead 13 Oct, 2014
Hi SPABO,

There should be some out put there from the DB Load action and I don't see anything. Is the Debugger after the DB Load action?

Bob
SPABO 17 Oct, 2014
Hi Bob,
Sorry for the delay..

Indeed, the DEBUGGER is after the DB Loader
Max_admin 17 Oct, 2014
Please post a new screenshot for both the "Events" area and the "Db multi record loader" config!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 18 Oct, 2014
Max, Pls bear in mind this is from JOOMLA 2.5 using Chronoforms V4!
It should work though...
Max_admin 18 Oct, 2014
And the "Events" area please, we need to check the actions order.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 18 Oct, 2014
Here it is Max
SPABO 19 Oct, 2014
Gents, I just instaaled the V5 version and followed the same instructions.

And it works now!

So, I assume the DB Recordloader in V4 is not working correctly.

Pls yr views on this...
SPABO 19 Oct, 2014
Next step: How to send an email to the selected user?

I tried your earlier suggestion, but I cannot get the mail function correctly
SPABO 21 Oct, 2014
Hi Max/Bob,

On a different site everthing works fine now in V5, however, how can I get an email send out to the emailaddress of the selected user?
This did not bring me further "It isn't good practice to add the teacher emails in the form so you can look them up using a second DB Load/Read in the On Submit event and use the Email in the Dynamic To box of the Email action."

Pls advise
GreyHead 21 Oct, 2014
Hi SPABO,

The DB Record Loader in CFv4 works correctly. There are no problems with it if it is configured correctly.

To get the email of the selected user you need to use a second DB Read action in the On Submit event and use the value from the drop-down to look up the matching address. In this case you just need to get a single result.

Bob
SPABO 21 Oct, 2014
Dear Mr Bob,
V4 DB read action does not work! I configured excactly like the V5 version!

No idea what you are saying with this:
To get the email of the selected user you need to use a second DB Read action in the On Submit event and use the value from the drop-down to look up the matching address. In this case you just need to get a single result.

Maybe ther is an example somewhere??
Max_admin 21 Oct, 2014
Hi SPABO,

The v4 action works, but you need to use the "db multi record loader" in order to load a list of records, in v4 the "db record loader" requires a request param or WHERE code to work!

Then, for security reasons, you will use the following fields in the text and value boxes in your dropdown: id, name

Then, as Bob explained, you need a "db record loader" in the "on submit", with the name of the dropdown field in the "request param" and "id" in the "db field", to load the selected user's info then use it as the "dynamic to" address, you should the "load undre model id" to NO in this action, and write "email" in the "dynamic to" field.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 23 Oct, 2014
Hi Max,
In J3.x I managed to get it working in the V5 version.

Now the V4 version:
I used the DB Record Loader instead teh Multirecord Loader 😟
So, the first part (to show the users) works now.

But the second part, to send out an email is still (my) problem.

Pls find some pictures of the Preview (drop down element) en the DB Record Loader in the OnSubmit area.

(in the email part in the tab Dynamic date is put "email" in the dynamic to field.

Where did I miss your guidance to get V4 working as well?
Max_admin 24 Oct, 2014
Hi SPABO,

You can add a debugger action after the "db record loader" to check its working as expected.

What's the field name of yoru dropdown ? is it name ? because you use "name" in the request param, that should match the dropdown field name.

Then, you don't have a table selected!!! you must select the users table.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
SPABO 28 Oct, 2014
Answer
Hi Bob/Max,

Both V4 and V5 version are working fine now.
Tx for the support again!

(Just wish to see the users from a specific usergroup still)
This topic is locked and no more replies can be posted.