Solved

passing value to formmail

Posted on 2009-07-02
4
224 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
  • 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 250 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now