Link to home
Start Free TrialLog in
Avatar of sallywizard
sallywizard

asked on

Why did JS on stop working?

Hi,
I have a simple form that needs to display additional fields if visitors select "yes". It worked fine but stopped working.

I don't recall making changes that would have impacted the form and need help.

Will update with link or send entire page if needed.

Thanks,

Sally
____________________________________

The JS functions:

<script type="text/javascript" >
// to display the return trip data if the return trip box is checked //
// DisplayReturn//
function DisplayReturn() {
	var selectreturn = document.getElementById("returntrip");
    if (selectreturn.value=='yes') {
        document.getElementById("returnride").style.display = 'block';
        document.getElementById("returndate").value = '';
        document.getElementById("returntime").value = '';
        document.getElementById("returndate").focus;
    } else {
        document.getElementById("returnride").style.display = 'none';
        document.getElementById("returndate").value = 'n/a';
        document.getElementById("returntime").value = 'n/a';
    }

// get name of Adult at destination for after school //
// DisplayAdultName//
function DisplayAdultName() {
	var selectcp = document.getElementById("AdultAtDestination");
    if (selectcp.value=='yes') {
        document.getElementById("adultnamediv").style.display = 'block';
        document.getElementById("adultname").value = '';
        document.getElementById("adultname").focus;
    } else {
        document.getElementById("adultnamediv").style.display = 'none';
        document.getElementById("adultname").value = 'n/a';
    }
} 

</script>


My form elements:
					<p ><label for="returntrip">Is return car service needed?</label>
					<select name="returntrip" id="returntrip" onchange="javascript:DisplayReturn()" >
						<option value="no">choose</option>
						<option value="yes">yes</option>
						<option value="no">no</option>
					</select> </p>
					<div id="returnride" >
						<p ><label for="returndate">Return Flight Arrival Date</label>
						<input type="text" name="returndate" id="returndate" class="REQUIRED LENGTH_INPUT DATE medium" value="n/a"  placeholder="" />
						</p>
						<p ><label for="returntime">Return Flight Arrival Time</label>
						<input type="text" name="returntime" id="returntime" class="REQUIRED LENGTH_INPUT medium" value="n/a"  placeholder="" />
						</p>
						<p ><label for="returnairline">Return Airline</label>
						<input type="text" name="returnairline" id="returnairline" class="medium"  />
						</p>
						<p ><label for="returnflightno">Return Flight number</label>
						<input type="text" name="returnflightno" id="returnflightno" class="medium"  placeholder="" />
						</p>
						<p ><label for="cellphone">Cell Phone</label>
						<input type="text" name="cellphone" id="cellphone" class="medium"  placeholder="" />
						</p>
					</div>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sallywizard
sallywizard

ASKER

Thank you! I looked and looked and just missed it. That did the job.
To padas - Thank you. Should I have attached the code in a text file? not sure how I missed the code box but after missing the end bracket... ~ Sally
You're welcome, glad to help.
>Should I have attached the code in a text file?

No, the best thing is to use the code box.  In the comment box you can see there is Bold, Italics, Underling, Bullet, Number, H2, Link, Quote, Code, Snippet, Image.

I think the snippet creates an attachment and the Code just embeds and that is what I did.