PDA

View Full Version : formmail + select box question



Burgerking63
07-19-2005, 05:49 PM
alright, I am just trying to dynamically add another recipient depending on the value of a selection menu. Depending on the index, it sets a hidden field "branch_mngr" to a corresponding email address. How can I add this value to my recipient field that is processed by my formmail script. I would prefer to do this via javascript as my company would rather not modify the formmail script itself. Here is what I tried so far:
<input type="hidden" name="recipient" value="[email protected], Edf.branch_mngr.value">
<input type="hidden" name="branch_mngr"> I know this isn't correct, so how would I go about retrieving the branch_mngr.value and have that as a recipient. I already have my select menu script setting this hidden field to an email address.

hourang
07-19-2005, 06:06 PM
like this??



<form name="theform">
<input type="hidden" name="recipient" value="[email protected]">
<input type="hidden" name="branch_mngr">

<script>
function UpdateRec(){
var bemail = document.theform.branch.value;
document.theform.branch_mngr.value = bemail;
document.theform.recipient.value = document.theform.recipient.value + "," + bemail;

}
</script>

<select name="branch" onChange="UpdateRec();"><option value="[email protected]">Branch Manager1</option></select>
<input type="submit">
</form>

Burgerking63
07-19-2005, 06:18 PM
That changed it properly and was what I was just in the process of doing ;), but the formmail script doesnt like the format. I have tried reading up on it, but nothing in the FAQ really covers having multiple recipients or adding recipients for a form submission. Is the format of "email COMMA email" not valid or correct, because I definetly have both email addresses in my allowedRecipients file.

Also, is it possible to have a primary recipient as well as a CC: a copy to another email? I would prefer to have both as primary recipients, but in the end, it just needs to work so both people get a copy of the submission. Any suggestions?

Burgerking63
07-19-2005, 06:44 PM
After some hard code testing, it would appear that the custom formmail script we are using, parses the recipient.value as a string, so even when I hardcode two valid email addresses into it, when it submits, it still doesnt send.

How would I go about modifying the formmail script to allow it to check for multiple emails in the recipient.value? I have little to no experience with Perl and really dont want to tinker with something that is already working. Thanks

hourang
07-19-2005, 07:14 PM
post the code for the formmail stuff.

Burgerking63
07-19-2005, 07:44 PM
all the recipient stuff is default, the custom stuff is just with referers and redirect

Burgerking63
07-19-2005, 09:47 PM
Does anyone know how to get the Formmail script to not read the recipient.value as a string, but as two seperate emails? Or is it possible to maybe split the two emails into two strings, then set the recipient.value to both of them? I have tried a number of methods which don't work and even though I have "two email" addresses being submitted, the script is reading them as "one string". Please help