Solved

IE7 & javascript not playing nice.  Javascript does not recognize form

Posted on 2007-12-03
7
525 Views
Last Modified: 2013-12-24
I have a field in my form that the user is to enter a number.  When the user changes the value, I calculate how much the order will cost and give an alert box with the amount.  I use Frontpage to help build sites quickly and then enter extra code as necessary, such as this.  In the Preview it works.  In IE7, it doesn't.  It seems as if IE7 is keeping the javascript from recognizing the form and its values.  I am getting an error stating that the 'FOMM_form' is undefined.  The form works and like I said, it is only crapping out in IE7.  Here is the code:


<html>
 
<head>
<title>Friends of Mountain Mahogany</title>
<meta name="Microsoft Theme" content="designed-by-m 011, default">
<SCRIPT language="JavaScript">
<!--
function calc(value)
{
value = FOMM_form.Farolitos_requested.value*2.5;
alert("The total amount for this order is $" + value);
}
// -->
</SCRIPT>
</head>
 
<body>
 
<form method="POST" action="--WEBBOT-SELF--" name="FOMM_form">
	<!--webbot bot="SaveResults" S-Email-Format="HTML/UL" S-Email-Address="fakeemail@domain.zzz" B-Email-Label-Fields="TRUE" B-Email-Subject-From-Field="FALSE" S-Email-Subject="order from FOMM Form" S-Builtin-Fields="HTTP_USER_AGENT Date Time" S-Date-Format="%A, %B %d, %Y" S-Time-Format="%I:%M:%S %p" -->
	<h2 align="center">Friends of Mountain Mahogany (FOMM) Community School</h2>
	<h3 align="center">1st Annual Farolito Sale</h3>
	<p align="center">Thank you for helping us to help our beloved school.&nbsp; 
	Please fill out the information below.&nbsp; We will draw our production 
	needs based on the results from this form.&nbsp; If you have any questions 
	or problems, please feel free to
	<a href="mailto:fakeemail@domain.zzz?subject=FOMM Form">contact us</a>.</p>
	<p>Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="4" -->
	<input type="text" name="name" size="40" tabindex="1"></p>
	<p>
	<input type="radio" value="do_have_a_child" checked name="community_member" tabindex="2">&nbsp; 
	I do have a child(ren) at MMCS.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="radio" name="community_member" value="do_no_have_a_child" tabindex="3">&nbsp; 
	I do NOT have a child(ren) at MMCS</p>
	<p>Phone Number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<!--webbot bot="Validation" s-data-type="String" b-allow-digits="TRUE" s-allow-other-chars="(xxx) xxx-xxxx" b-value-required="TRUE" i-minimum-length="14" i-maximum-length="14" -->
	<input type="text" name="phone" size="14" value="(505) " tabindex="4" maxlength="14"></p>
	<p>Number of Farolitos to purchase:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<!--webbot bot="Validation" s-data-type="String" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="3" s-validation-constraint="Greater than" s-validation-value="1" -->
	<input type="text" name="Farolitos_requested" size="3" tabindex="5" maxlength="3" onchange="calc(value)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>
	<p>Have you placed a previous order?&nbsp; </p>
	<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="radio" name="New_order" value="No" checked tabindex="6">No.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="radio" name="New_order" value="Yes_change_order" tabindex="7">Yes, 
	and I am requesting a change to my order.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="radio" name="New_order" value="yes_add_to_order" tabindex="8">Yes, 
	and I am requesting to add to my order.</p>
	<p>Pick Up Time requested:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<!--webbot bot="Validation" s-display-name="Time_Requested" b-value-required="TRUE" b-disallow-first-item="TRUE" -->
	<select size="1" name="Time_requested" tabindex="9">
	<option selected>Select a time</option>
	<option>10:00 am</option>
	<option>10:30 am</option>
	<option>11:00 am</option>
	<option>11:30 am</option>
	<option>12:00 pm</option>
	<option>12:30 pm</option>
	<option>1:00 pm</option>
	<option>1:30 pm</option>
	<option>2:00 pm</option>
	<option>2:30 pm</option>
	<option>3:00 pm</option>
	</select></p>
	<p>&nbsp;</p>
	<p align="center">
	<input type="submit" value="Submit" name="B1" tabindex="10"><input type="reset" value="Reset" name="B2" tabindex="11"></p>
</form>
 
</body>
 
</html>

Open in new window

0
Comment
Question by:prostang
  • 3
  • 2
7 Comments
 
LVL 3

Expert Comment

by:getmorepc
ID: 20399194
More people use IE6 or Firefox. Make sure permissions in the browser are right (java and js enabled) and the site is in the trusted zone.
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 20399235
>>> value = FOMM_form.Farolitos_requested.value*2.5;


Try this instead:

value = document.FOMM_form.Farolitos_requested.value*2.5;
0
 

Author Comment

by:prostang
ID: 20400414
b0lsc0tt,
Thank you for the removal.  It was an ovesight on my part

routinet,
Your answer led me to the solution being:
value = document.FrontPage_Form1.Farolitos_requested.value*2.5
I tried your suggestion and it didn't work, but as I started typing the document. part, it entered the Frontpage_Form1 part.  It doesn't make sense to me, but it is working now.

Thanks again.
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 50

Accepted Solution

by:
Steve Bink earned 250 total points
ID: 20401071
That's the name of the form.  I used your naming convention in my post.  This is from live version:

<form [ ..snip.. ] name="FrontPage_Form1"

Glad to hear it is resolved.  Good luck!
0
 

Author Comment

by:prostang
ID: 20401215
I understand that it is the name of the form, but as you can see in my code snippet, that is not the name I gave it, and it is not the name that I posted on the web to test.  I just....changed?
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 20406942
Right, but it was the name on line 19 of your original question, which is where I got it from.  No matter...at least it was a simple fix, yes?  :)
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

813 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

14 Experts available now in Live!

Get 1:1 Help Now