Buy Now
Sign in

populating a field with an email from database load to send the submitted form to, as the dynamic to email

Wells2013 , January 13 at 22:10
W
Wells2013
I am trying to create a form that a site visitor can use to send information to a registered user whose data has been saved in a database.

In this form, among other fields, the site visitor is to fill a field (field name: username) requesting the username of the concerned registered user. In the form there is also an hidden field (field name: email) that I desire to be populated from the database.

My intention is for the data that the site visitor will provide in the username field to trigger the hidden field (field name: email) to be populated with the email in the database related to the provided username. So that when the form is submitted, the email function can send the form to the email in this hidden field, acting as the dynamic to.

The database name is reviewdata, Model ID is off, the field to be populated have thesame field name in the database record.

Can this be achieved? Please how can I use database load to achieve this? To be more specific, what do I fill into the options below, and please help me with the conditions i should use.

1. Fields (list of fields to read, comma separated)
2. Order (the returned records order fields list, comma separated)
3. Conditions

Thank you in advance
GreyHead
Hi Wells2013,

I'm not clear how the selection of a user is done. Do you want to display a drop-down with a list of all users? Or some other method?

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
W
Wells2013
Hello Bob,

Thank you for responding.

The user name and few other info the site visitor needs to fill the form are provided from a web page, the site visitor is to type in the username into the text field (field name: username).

We simply do not want the site visitor to have direct access to the email of the user. But we want the user to receive a copy of the submitted form via email.

Thank you
W
Wells2013
The same form serves different registered user, and the username provided by the site visitor triggers or determines the user's email that is populated on the form.
admin
Hi Wells,

Is this a new form ? I suggest using v6 which can be installed with v5 on the same website just fine.

You need to load a record based on the user input ? then you need to use the where conditions, after selecting the table, match the table fields names with the form inputs names:

table_field_name:{data:form_field_name}


The data returned can be accessed using {var:read_data_name.Model_name.field_name} which you can use in the email "Recipients" box.

Best regards
Max
If your main question got answered then please mark the answer using the button!​

Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
W
Wells2013
Thank you for your reply. I have been trying to work it but I have not succeeded.

I am trying to stick to V5 because of its joomla article creation feature which I cannot find in V6. I think what I need is the where conditions for V5. The field name (username) is to be filled in the first page to trigger database read in the second page populating two fields (name, email). Model ID is off.
Please help me with the conditions for V5. There is no Model ID.

Can I use the {var:read_data_name.Model_name.field_name} in recipient box in V5.
W
Wells2013
I could see that v6 seems easier to produce what I need. So, I wanted to use V5 for the form that creates the joomla article and save to database, and the v6 for the form that retrieves the data using db read, however, I have one problem, v6 requires a model ID. Each time I use model ID for V5, it creates the new record, but the values for the database field names are empty after submitting the form.
I read in your Q&A to use the model name in the field name of the form (Model ID[field_name]). my model name is 'Author'. In creating the fields (e.g field name: username), I used Author[username] as the field name and field ID. In thesame way I created for the other fields. The database table equally has the field names in the same format (e.g Author[username]). Model ID was enabled and the model name was indicated as Author. Did I do anything wrong?

Additional, the create joomla article feature in V5 doesn't work well using field names like (Author[username]) on the form.
admin
Hi Wells,

You can not use that syntax in v5, but you can create an article in v6 by using a "data save" action and pointing to the articles table, just provide the article info needed like title and text.

The Model name although required for the action, but it does not have to be used any where unless you are connecting multiple tables.

Best regards
Max
If your main question got answered then please mark the answer using the button!​

Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!