this form calculates and it works in IE and safari but not in firefox - in firefox everything works EXCEPT the calculation. can anyone pleae help me know why so i can fix it? thank you i am including script first, then the form code:

script:

<SCRIPT language="JavaScript">
function Calculate()
{
if (familypackform.Qtz1.value == 1)
familypackform.CostPorkFP.value = familypackform.QtyPorkFP.value * 250;
else
familypackform.CostPorkFP.value = familypackform.QtyPorkFP.value * familypackform.Qtz1.value * 250;

if (familypackform.Qtz2.value == 1)
familypackform.CostBeefFP.value = familypackform.QtyBeefFP.value * 300;
else
familypackform.CostBeefFP.value = familypackform.QtyBeefFP.value * familypackform.Qtz2.value * 300;

familypackform.Subtotal.value = parseFloat(familypackform.CostPorkFP.value) + parseFloat(familypackform.CostBeefFP.value);
}
</SCRIPT>

form code:

<form NAME="familypackform" action="/cgi-bin/FormMail.pl" method=POST>
		<input type="hidden" name="recipient" value="tina@rockisland.com">
          <input type="hidden" name="title" value="Form">
          <input type="hidden" name="subject" value="Form">
		   <input type="hidden" name="X-From_" value="email">
          <input type="hidden" name="print_config" value="email">
          <input type=hidden name="required" value="email">
          <tr>
            <td colspan="9" bgcolor="#FFCC99" class="style12"><span class="style18">FAMILY PACK ORDER FORM </span></td>
          </tr>
          <tr>
            <td width="109" class="style12"><div align="right">Name</div></td>
            <td colspan="8" class="style9"><input name="Name" type="text" id="Name" size="50" maxlength="50" />            </td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Address</div></td>
            <td colspan="8" class="style9"><input name="Address" type="text" id="Address" size="50" maxlength="50" />            </td>
          </tr>
          <tr>
            <td class="style12"><div align="right">City</div></td>
            <td colspan="8" class="style9"><input name="City" type="text" id="City" size="50" maxlength="50" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Zip</div></td>
            <td colspan="8" class="style9"><input name="Zip" type="text" id="Zip" size="15" maxlength="15" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Telephone</div></td>
            <td colspan="8" class="style9"><input name="Phone" type="text" id="Phone" size="30" maxlength="30" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">email</div></td>
            <td colspan="8" class="style9"><input name="email" type="text" id="email" size="30" maxlength="30" /></td>
          </tr>
          <tr>
            <td height="25" colspan="9" class="style9">&nbsp;</td>
          </tr>
          
          
          <tr>
            <td colspan="4" class="style9"><div align="left" class="style15"></div>
            <div align="center"></div></td>
            <td width="43" class="style12"><div align="center">Est. Weight</div></td>
            <td width="53" class="style12"><div align="center">Quantity</div></td>
            <td width="73" class="style12">Price</td>
            <td width="66" class="style12"><div align="center">Total $ </div></td>
            <td width="157" class="style12">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4" class="style9" bgcolor="#FFCC99"><div align="left"><span class="style15">Pork Family Pack </span></div></td>
            <td class="style9"><div align="center">35</div></td>
            <TD>              <P align="center">
<INPUT TYPE="TEXT" NAME="QtyPorkFP" id="QtyPorkFP" SIZE="5"
onBlur="Calculate();">
              </TD>
<TD class="style9"><p align="center">250</font>
<INPUT TYPE="hidden" NAME="Qtz1" id="Qtz1"SIZE="5"
onBlur="Calculate();" value="1">
  </TD>
<TD>
  <div align="center">
<INPUT TYPE="TEXT" NAME="CostPorkFP" id="CostPorkFP"SIZE="5">
  </div></TD>
            <td class="style9">Available April1 - Dec 31 </td>
          </tr>
          <tr>
            <td colspan="4" class="style9" bgcolor="#FFCC99"><div align="left"><span class="style15">Beef Family Pack </span></div></td>
            <td class="style9"><div align="center">37</div></td>
            <TD bgcolor="">                  <P align="center">
<input type="TEXT" name="QtyBeefFP" id="QtyBeefFP"size="5"
onBlur="Calculate();">
            </TD>
            <TD bgcolor="" class="style9"><p align="center">300
<INPUT TYPE="hidden" NAME="Qtz2" id="Qtz2"SIZE="5"
onBlur="Calculate();" value="1">
            </TD><TD bgcolor="">
			<div align="center">
<INPUT TYPE="TEXT" NAME="CostBeefFP" id="CostBeefFP"SIZE="5">            
            </div></TD>
            <td class="style9">Available Sept 1 - Dec 15 </td>
          </tr>
          <tr>
            <td  colspan="5" class="style12">&nbsp;</td>
            <td class="style12">&nbsp;</td>
            <TD bgcolor=""><B class="style12">Total</B></TD>
            <TD bgcolor=""><INPUT TYPE="TEXT" NAME="Subtotal" id="Subtotal"SIZE="8" >            </TD>
            <td class="style12">&nbsp;</td>
          </tr>
          <tr>
            <td  colspan="9" class="style12">Specify Pick-up Location and Date </td>
          </tr>
          <tr>
            <td  colspan="9" class="style9"><table width="550" border="1" cellpadding=" 2">
              <tr>
                <td width="24"><input name="University FM" type="checkbox" id="University FM" value="checked"></td>
                <td width="169">University Farmers Market </td>
                <td width="104">Saturdays 9-2 </td>
                <td width="84"><div align="right">Date</div></td>
                <td width="137"><input name="UFM Date" type="text" id="UFM Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Farm Store" type="checkbox" id="Farm Store" value="checked"></td>
                <td>Farm Store </td>
                <td>Saturdays 10-6 </td>
                <td><div align="right">Date</div></td>
                <td><input name="Farm Store Date " type="text" id="Farm Store Date " size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Ballard FM" type="checkbox" id="Ballard FM" value="checked"></td>
                <td>Ballard Farmers Market </td>
                <td>Sundays 10-3 </td>
                <td><div align="right">Date</div></td>
                <td><input name="Ballard Date" type="text" id="Ballard Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Anacortes BC" type="checkbox" id="Anacortes BC" value="checked"></td>
                <td>Anacortes Buyer's Club </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Anacortes BC Date" type="text" id="Anacortes BC Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Woodinville BC" type="checkbox" id="Woodinville BC" value="checked"></td>
                <td>Woodinville BC </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Woodinville BC Date" type="text" id="Woodinville BC Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Bellevue BC" type="checkbox" id="Bellevue BC" value="checked"></td>
                <td>Bellevue Buyer's Club </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Bellevue BC Date" type="text" id="Bellevue BC Date" size="15" maxlength="15"></td>
              </tr>
            </table></td>
          </tr>
          
          
          <tr>
            <td colspan="9" class="style9"><textarea name="Comments" cols="60" rows="10" wrap="virtual" id="Comments">Comments and Instructions:</textarea></td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><input type="checkbox" name="I will call you with my credit card number" value="checked" />
              I will call you with my Credit Card Number </td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><input type="checkbox" name="I will mail a check" value="checked" />
              I will mail a check </td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><div align="center">
                <div align="left">
                  <input type="submit" name="Submit" id="Submit"value="Submit Form">
				  <input name="Reset" type="reset" id="Reset" value="Reset" />

Recommended Answers

All 8 Replies

is it giving any Javascript error.?? i have tested code.. its work fine for IE and Firefox as well. let me know whts error u r getting.

this form calculates and it works in IE and safari but not in firefox - in firefox everything works EXCEPT the calculation. can anyone pleae help me know why so i can fix it? thank you i am including script first, then the form code:

script:

<SCRIPT language="JavaScript">
function Calculate()
{
if (familypackform.Qtz1.value == 1)
familypackform.CostPorkFP.value = familypackform.QtyPorkFP.value * 250;
else
familypackform.CostPorkFP.value = familypackform.QtyPorkFP.value * familypackform.Qtz1.value * 250;

if (familypackform.Qtz2.value == 1)
familypackform.CostBeefFP.value = familypackform.QtyBeefFP.value * 300;
else
familypackform.CostBeefFP.value = familypackform.QtyBeefFP.value * familypackform.Qtz2.value * 300;

familypackform.Subtotal.value = parseFloat(familypackform.CostPorkFP.value) + parseFloat(familypackform.CostBeefFP.value);
}
</SCRIPT>

form code:

<form NAME="familypackform" action="/cgi-bin/FormMail.pl" method=POST>
		<input type="hidden" name="recipient" value="tina@rockisland.com">
          <input type="hidden" name="title" value="Form">
          <input type="hidden" name="subject" value="Form">
		   <input type="hidden" name="X-From_" value="email">
          <input type="hidden" name="print_config" value="email">
          <input type=hidden name="required" value="email">
          <tr>
            <td colspan="9" bgcolor="#FFCC99" class="style12"><span class="style18">FAMILY PACK ORDER FORM </span></td>
          </tr>
          <tr>
            <td width="109" class="style12"><div align="right">Name</div></td>
            <td colspan="8" class="style9"><input name="Name" type="text" id="Name" size="50" maxlength="50" />            </td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Address</div></td>
            <td colspan="8" class="style9"><input name="Address" type="text" id="Address" size="50" maxlength="50" />            </td>
          </tr>
          <tr>
            <td class="style12"><div align="right">City</div></td>
            <td colspan="8" class="style9"><input name="City" type="text" id="City" size="50" maxlength="50" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Zip</div></td>
            <td colspan="8" class="style9"><input name="Zip" type="text" id="Zip" size="15" maxlength="15" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">Telephone</div></td>
            <td colspan="8" class="style9"><input name="Phone" type="text" id="Phone" size="30" maxlength="30" /></td>
          </tr>
          <tr>
            <td class="style12"><div align="right">email</div></td>
            <td colspan="8" class="style9"><input name="email" type="text" id="email" size="30" maxlength="30" /></td>
          </tr>
          <tr>
            <td height="25" colspan="9" class="style9">&nbsp;</td>
          </tr>
          
          
          <tr>
            <td colspan="4" class="style9"><div align="left" class="style15"></div>
            <div align="center"></div></td>
            <td width="43" class="style12"><div align="center">Est. Weight</div></td>
            <td width="53" class="style12"><div align="center">Quantity</div></td>
            <td width="73" class="style12">Price</td>
            <td width="66" class="style12"><div align="center">Total $ </div></td>
            <td width="157" class="style12">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="4" class="style9" bgcolor="#FFCC99"><div align="left"><span class="style15">Pork Family Pack </span></div></td>
            <td class="style9"><div align="center">35</div></td>
            <TD>              <P align="center">
<INPUT TYPE="TEXT" NAME="QtyPorkFP" id="QtyPorkFP" SIZE="5"
onBlur="Calculate();">
              </TD>
<TD class="style9"><p align="center">250</font>
<INPUT TYPE="hidden" NAME="Qtz1" id="Qtz1"SIZE="5"
onBlur="Calculate();" value="1">
  </TD>
<TD>
  <div align="center">
<INPUT TYPE="TEXT" NAME="CostPorkFP" id="CostPorkFP"SIZE="5">
  </div></TD>
            <td class="style9">Available April1 - Dec 31 </td>
          </tr>
          <tr>
            <td colspan="4" class="style9" bgcolor="#FFCC99"><div align="left"><span class="style15">Beef Family Pack </span></div></td>
            <td class="style9"><div align="center">37</div></td>
            <TD bgcolor="">                  <P align="center">
<input type="TEXT" name="QtyBeefFP" id="QtyBeefFP"size="5"
onBlur="Calculate();">
            </TD>
            <TD bgcolor="" class="style9"><p align="center">300
<INPUT TYPE="hidden" NAME="Qtz2" id="Qtz2"SIZE="5"
onBlur="Calculate();" value="1">
            </TD><TD bgcolor="">
			<div align="center">
<INPUT TYPE="TEXT" NAME="CostBeefFP" id="CostBeefFP"SIZE="5">            
            </div></TD>
            <td class="style9">Available Sept 1 - Dec 15 </td>
          </tr>
          <tr>
            <td  colspan="5" class="style12">&nbsp;</td>
            <td class="style12">&nbsp;</td>
            <TD bgcolor=""><B class="style12">Total</B></TD>
            <TD bgcolor=""><INPUT TYPE="TEXT" NAME="Subtotal" id="Subtotal"SIZE="8" >            </TD>
            <td class="style12">&nbsp;</td>
          </tr>
          <tr>
            <td  colspan="9" class="style12">Specify Pick-up Location and Date </td>
          </tr>
          <tr>
            <td  colspan="9" class="style9"><table width="550" border="1" cellpadding=" 2">
              <tr>
                <td width="24"><input name="University FM" type="checkbox" id="University FM" value="checked"></td>
                <td width="169">University Farmers Market </td>
                <td width="104">Saturdays 9-2 </td>
                <td width="84"><div align="right">Date</div></td>
                <td width="137"><input name="UFM Date" type="text" id="UFM Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Farm Store" type="checkbox" id="Farm Store" value="checked"></td>
                <td>Farm Store </td>
                <td>Saturdays 10-6 </td>
                <td><div align="right">Date</div></td>
                <td><input name="Farm Store Date " type="text" id="Farm Store Date " size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Ballard FM" type="checkbox" id="Ballard FM" value="checked"></td>
                <td>Ballard Farmers Market </td>
                <td>Sundays 10-3 </td>
                <td><div align="right">Date</div></td>
                <td><input name="Ballard Date" type="text" id="Ballard Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Anacortes BC" type="checkbox" id="Anacortes BC" value="checked"></td>
                <td>Anacortes Buyer's Club </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Anacortes BC Date" type="text" id="Anacortes BC Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Woodinville BC" type="checkbox" id="Woodinville BC" value="checked"></td>
                <td>Woodinville BC </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Woodinville BC Date" type="text" id="Woodinville BC Date" size="15" maxlength="15"></td>
              </tr>
              <tr>
                <td><input name="Bellevue BC" type="checkbox" id="Bellevue BC" value="checked"></td>
                <td>Bellevue Buyer's Club </td>
                <td>&nbsp;</td>
                <td><div align="right">Date</div></td>
                <td><input name="Bellevue BC Date" type="text" id="Bellevue BC Date" size="15" maxlength="15"></td>
              </tr>
            </table></td>
          </tr>
          
          
          <tr>
            <td colspan="9" class="style9"><textarea name="Comments" cols="60" rows="10" wrap="virtual" id="Comments">Comments and Instructions:</textarea></td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><input type="checkbox" name="I will call you with my credit card number" value="checked" />
              I will call you with my Credit Card Number </td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><input type="checkbox" name="I will mail a check" value="checked" />
              I will mail a check </td>
          </tr>
          <tr>
            <td colspan="9" class="style9"><div align="center">
                <div align="left">
                  <input type="submit" name="Submit" id="Submit"value="Submit Form">
				  <input name="Reset" type="reset" id="Reset" value="Reset" />

hi and thank you for responding - i found the error but i still don't know why it is a problem -

in Dreamweaver there is a line before the <html> tag that reads:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

when i removed that line and posted the page , the form calculates in Firefox - when that line is at the top of the code, the form does not calculate in firefox -

do you know why this is?

thanks for any ideas and also again for responding.
tina

Because you using wrong DOCTYPE declaration, check this out

i have now tried all the doc types and none allows my form to calculate in FF.
1. how do i find a doc type that will work here.
2. i assume it is bad to have a page without a doc type at the top of the code - is this true?
thanks for the help- i am at a loss - other pages i have with forms work fine with the transitional 1.0 XHTML doc type , but they do not have calculation. is there a doc type that is specific to javascript of this kind?

i found that the following at the top or in head contents will make the calculation work, but while it is hiddden in IE it shows in FF as text. can you help me with how to use this so it doesn't show up as text? thank you

<%@ page contentType="text/html; charset=ISO-8859-1" language="java" import="java.sql.*" errorPage="" %>

using the error console in FF i found the following errors:
Error:familypackform is not defined
here is my code for familypackform-what do i need to say to "define" it?:

<form NAME="familypackform" id="familypackform" action="/cgi-bin/FormMail.pl" method=POST>

other error:
Error: uncaught exception: Permission denied to call method Location.toString

can anyone tell me what this means?

<%@ page contentType="text/html; charset=ISO-8859-1" language="java" import="java.sql.*" errorPage="" %>

This is has nothing to do with your code, I have no idea where you got it and you should not be using it. This is for JSP (Java Servlet Pages) that is based on Java. Java and JavaScript are not the same and you should always be careful when uing these two technologies together. This line wouldn't been showed in IE because IE doesn't follow w3c standards closely. Check code in FF and then see it in IE, not other way around.

For the "familypackform" I have no idea what the error is about can be even your Pearl scripting.

@Permission denied to call method Location.toString - I do not see this call anywhere in the code you submited. Did you do any changes to it since your post?

<%@ page contentType="text/html; charset=ISO-8859-1" language="java" import="java.sql.*" errorPage="" %> This declaration is for java server pages. It has nothing to do with java script. If you write this in an html page it would consider it as plain text and display it on browser as text. In a jsp page you should write this declaration to import classes or declare page as error page and run this jsp page through a jsp container like tomcat. Other wise you will see it as plain text as you have right now. For more information on JSP See JSP Technology.

I hope this will help :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.