Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting A subject field

Status
Not open for further replies.

richrich05

Programmer
Aug 15, 2005
24
US
I need help i'm trying to control the subject of a email on a form using set text plus a drop down field value.

function getsubject()
{
var Request = document.FrontPage_Form2.Request

for (i=0; i < Request.length; i++)
{
if (Request.options.selected)
{
var subject = Request.options.value
}
}

return subject;
}

function setsubject()
{
var subjectFixed = "Process Development Request:"

if (subjectFixed.length > 0)
{
document.FrontPage_Form2.subject.value = subjectFixed + getsubject();
}
else
{
document.FrontPage_Form2.subject.value = getsubject();
}
document.FrontPage_Form2.submit();

window.alert("recipient = " + document.FrontPage_Form2.subject.value);

}



the name of the drop down field is Request. Does anyone know what i'm doing wrong?
 
do this:

Code:
function getsubject()
{
   var Request = document.forms['FrontPage_Form2'].elements['Request'];
   var subject = Request.options[Request.selectedIndex].value;
   return subject;
}

*cLFlaVA
----------------------------
[tt]your mom goes to college[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top