Contact Form setting + Multiple Values Broke - Patch Posted
| Project: | Email Field |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
When you have an email field set to use contact form and you also tell it to have multiple values this problem occurs. What happens is all of the contact forms send to the first email address given. Instead they should each send to their own email address.
Steps to reproduce:
- Create a email field
- Set the Email Link Type to Contact Form
- Check the multiple values box
- Create a new node of the type where you added the custom email field
- Fill in the three email field text boxes with different email address
- Save the newly created node and view it
- Click on the second or third Contact Form links
- Fill it out and send the email
- Notice the problem - It will send the email to the first address
I have figured out how to fix this. All I do is append the index of the email field to the contact form link. I then use this index in the email_mail_page_form_submit function to retrieve the correct email address. Currently line 346 says $email = $field[0]['email'] that is where the problem is. It needs to say instead $email = $field[$indexVal]['email']. I will submit a patch if you want me to, but I've never done it before and I'm a beginner at PHP so you might need to walk me through it and you probably want to check my code carefully.

#1
Here is a patch file with the changes I made to make this work. I've tested it for all my situations and it works great. Anyone else wants to test it that would be helpful.
#2
#3
I have sense discovered that my patch file had a bug in it. Don't use the patch file above because if you do the first user's email form will not work. Instead use this patch file.
#4
I know this has been dead for a while now, but is there a way to use multiple values but only one contact form? I'd like to send the contact email to two people, but I'd like that to be seamless to the person sending the email.
Maybe this should be a new issue but it does fall into place with this thread somewhat.
Thanks in advance.
Jesse
#5
YES I need this as well. Two emails. One contact form. Any ideas?