Using A Repeat Inside An Input?

Is it possible to use … dmx-repeat:repeat_email=“sc_staff_list.data.staff_list” {{email_address}} … inside a form input?

What I am trying to do is place the result of a dynamic repeat of email addresses inside an input $_POST.staff_email so it can be used to send an email message.

Please take a look at the code in the attached image and let me know if it can be done.

If not, what would be a better way to do it?

Thank you for any help with this.

Hello,
How are these emails stored in the DB? In separate rows or are they stored in one field? Are you using a separate DB query to retrieve them?

Yes there is a table with staff list that contains a row for each staffer’s data. It’s the same database, but different tables…

Table for the missionaries
Table for the regional directors
Table for the staff.

The objective it to broadcast one email message to everyone.

This is the form that gathers the info and initiates the send command.

But you don’t need to do this using hidden fields on the page.
You should do this directly in the server action. Just a question before i explain you how to do this. Should the email be sent to all the guys as recipients (meaning all are listed in mail to field) or do you prefer to loop through the emails and send the same mail individually to all users?

Either way would accomplish the task. However, the loop method might be a cleaner output in the email header. I am opened to whatever you think would be the best and most efficient.

The top field is to search for the missionary; then the search query gathers all the other representatives relative to the located missionary. Then that is displayed only for verification to the person searching. The other email addresses of the staff will be hidden.

In your server action, just create a query - which gets the emails, add a repeat step after the query (which repeats the query) and in the repeat step put the send mail step.
Then bind the recipient binding in the recipient field and you are done. The repeat will be executed as many times as the records are returned from the query:

Same is valid for any action which needs to be executed per record from your db.

1 Like

Excellent, I will give it a go. Thank you very much!

1 Like

Quick question, is there no need for a database connection step prior to the query? All of the staff info resides in a table in the database.

The form provides the $_POST data for the missionary, regional director and other meeting details that will eventually populate the HTML email.

Once the submit button is clicked it initiates the action steps within your example, and sends the email to each recipient as well as each staff member.

With the Recipient(s) set to Extended, the name, and email address for the missionary will be $_POST’ed in the Recipient(s): To Name and To Email.

The regional director’s email will be placed in the Recipient(s): CC

The staff queried email list will be placed in the Recipient(s): Bcc

To me, it appears that the above steps would duplicate an email to the MS and RD? Is this correct?

Please forgive my fogged mind this morning.

Thanks for any suggestions.