Hey Guys,
I'm new here, what's up ?! Anyway, I'm creating a form which I need the values of certain options selected to return as strings to an option value in a drop down list. I dont know what's going on:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
h1 {
font-family: Arial, Helvetica, sans-serif;
text-decoration: underline;
}
.style1 {color: #FFFFFF}
.MailHide {
display: none;
}
.MailSee {
display: block;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_setTextOfTextfield(objId,x,newText) { //v9.0
with (document){ if (getElementById){
var obj = getElementById(objId);} if (obj) obj.value = newText;
}
}
//-->
</script>
<script type ="text/javascript">
//Initial Rebate Form Month Case Check
function Rebate() {
if (document._xclick.months.value > 3)
{
var myDiv = document.getElementById("RebateText");
myDiv.innerHTML = "Your order may qualify for a monthly rebate! Please use the contact form below FIRST before you begin the transaction.";
document.getElementById("submit").disabled = true
var DisplayMe = document.getElementById("NewForm");
DisplayMe.setAttribute("class", "MailSee")
}
else{
var myDiv = document.getElementById("RebateText");
myDiv.innerHTML = ""
document.getElementById("submit").disabled = false
var DisplayMe = document.getElementById("NewForm");
DisplayMe.setAttribute("class", "MailHide")
}
}
// Opens Form for Inquiry
function makeForm() {
if (document._xclick.months.value > 3){
}
}
//House Selection Checker
function HouseSel(){
if (document.getElementById("HouseSelect").value == 0) {
document.getElementById("submit").disabled = true
if (document._xclick.months.value > 3) {
var myDiv = document.getElementById("RebateText");
myDiv.innerHTML = "You did not choose a house, and for the amount of time you wish to stay, You may also qualify for a monthly rebate! Please select a house first.";
var DisplayMe = document.getElementById("NewForm");
DisplayMe.setAttribute("class", "MailHide")
}
else{
var myDiv = document.getElementById("RebateText");
myDiv.innerHTML = "You did not choose a house!";
var DisplayMe = document.getElementById("NewForm");
DisplayMe.setAttribute("class", "MailHide")
}
}
else {
document.getElementById("submit").disabled = false
}
//Validate Selection for PayPal
if (document.getElementById("HouseSelect").value == 1) {
alert ("Checked and True")
//---This is Where the problem is...
document.getElementById("HouseSelect").value = "Rent Deposite: Nags Head: " + document.getElementById("fromf").value + " to " + document.getElementById("tof").value
//---------------------------------
alert (document.getElementById("HouseSelect").value)
}
}
//End Customs
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
</script>
</head>
" value="Calculate"/>
<br />
</h4>
<div id =RebateText></div>
<div class="MailHide" id = NewForm>
<input type="button" onclick="MM_goToURL('parent','contactform.html');return document.MM_returnValue" value="MAIL NOW">
<input name="Name" type="hidden" id="Name" value = "Sarah Vaugn" />
</div>
-----------------------------------------------------------------------------------<br />
*Price:
<label>
$
<input name="amount" type="text" id="amount" tabindex="3" onfocus="MM_setTextOfTextfield('amount','','DO NOT CLICK HERE!');MM_callJS('document.getElementById(\"submit\".disabled = true')" onchange="MM_setTextOfTextfield('amount','','Enter a Value Above');MM_callJS('document.getElementById(\"submit\".enable = true')" value="0.00" />
</label>
USD<br />
(This Field MUST have a price quote else the form will not submit! Please be sure that all fields are filled out.)<br />
<label>
<input name="submit" type="submit" id="submit" onclick=" MM_validateForm('firstname','','R','lastname','','R','amount','','R');return document.MM_returnValue" value="Submit Payment" />
</label>
<br>
</form>
</div>
</p>
</div>
</body>
</html>
And here's where I think the problem is: //---This is Where the problem is...
document.getElementById("HouseSelect").value = "Rent Deposite: Nags Head: " + document.getElementById("fromf").value + " to " + document.getElementById("tof").value
I think it's because you cant set something using a return statement like this. But I dont know what to use...