?
Solved

passing value to formmail

Posted on 2009-07-02
4
Medium Priority
?
234 Views
Last Modified: 2012-05-07
Hi,

Recently I have been asked to make a modification to the html form that calls it.

I use the id "recipient" on a select menu and depending the value selected from the drop down list, a specific person receives an email, like this:

<select name="recipient" id="recipient">
<option value="luisnava-gomez1@thisplace.com">Luisville, TEST</option>
<option value="luisnava-gomez2@thisplace.com">Jillville, TEST</option>
<option value="luisnava-gomez3@thisplace.com">Heatherton, TEST</option>
</select>

my question is:

passing the email value according to the value selected is working for luis1, luis2, and luis3. How can I also pass the values that is actually selected by the user?
in this case: Luisville, TEST, Jillville, TEST, Heatherton, TEST


Thank you much for your help.

0
Comment
Question by:itortu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:8riaN
ID: 24765091
Hard to tell exactly what you are asking.

Do you mean you want the email address of the recipient to show the text "Luisville, Test" text in the "to" address of the resulting email? In that case, replace your options list with the one below. Otherwise, explain what you want in more detail, please.

8riaN
<option value="Luisville, TEST <luisnava-gomez1@thisplace.com>">Luisville, TEST</option>
<option value="Jillville, TEST <luisnava-gomez2@thisplace.com>">Jillville, TEST</option>
<option value="Heatherton, TEST <luisnava-gomez3@thisplace.com>">Heatherton, TEST</option>

Open in new window

0
 

Author Comment

by:itortu
ID: 24765232
what i want is to be able to select "Luisville, TEST" and
then luisnava-gomez1 will receive the email and also the value "Luisville, TEST" in the email body.

if select "Jillville, TEST" then luisnava-gomez2 will receive the email and the value "Jillville, TEST" in the email body
0
 
LVL 5

Accepted Solution

by:
8riaN earned 1000 total points
ID: 24765367
Then you'd need javascript to populate another hidden field.  Like this:


<head>
...
<script type="text/javascript">
function formSubmitted(thisForm) {
   with(thisForm) {
      nameSelected.value = recipient.options[recipient.selectedIndex].text;
   }
}
</script>
</head>
 
...
 
<form action="formmal.pl" method="post" onSubmit="formSubmitted(this) ;">
<input type="hidden" name="nameSelected">
...
</form>

Open in new window

0
 

Author Closing Comment

by:itortu
ID: 31599251
Thank you, that was exactly what I was looking for.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
This article will show, step by step, how to integrate R code into a R Sweave document
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question