• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 591
  • Last Modified:

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

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:

<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);
// -->
<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>
	<!--webbot bot="Validation" b-value-required="TRUE" i-minimum-length="4" -->
	<input type="text" name="name" size="40" tabindex="1"></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>
	<input type="radio" name="New_order" value="No" checked tabindex="6">No.<br>
	<input type="radio" name="New_order" value="Yes_change_order" tabindex="7">Yes, 
	and I am requesting a change to my order.<br>
	<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>
	<p align="center">
	<input type="submit" value="Submit" name="B1" tabindex="10"><input type="reset" value="Reset" name="B2" tabindex="11"></p>

Open in new window

  • 3
  • 2
1 Solution
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.
Steve BinkCommented:
>>> value = FOMM_form.Farolitos_requested.value*2.5;

Try this instead:

value = document.FOMM_form.Farolitos_requested.value*2.5;
prostangAuthor Commented:
Thank you for the removal.  It was an ovesight on my part

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.
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Steve BinkCommented:
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!
prostangAuthor Commented:
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?
Steve BinkCommented:
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?  :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now