Forum Moderators: open

Message Too Old, No Replies

trouble running two forms in FF

         

JimHo

11:47 am on May 25, 2007 (gmt 0)

10+ Year Member



I have a page with two forms that I am having trouble with in Firefox.

The first form gathers product data from the user through inputs and select boxes, and then updates the second form with that information.

The second form is a cgi script that sends the data with some contact info via email.

I toggle between the two by using the display:none or display:block on the forms.

When the page first loads, form1 is set to display:block, and form2 is set to display:none via the css stylesheet.

After the user fills out form1 and clicks a button, an onclick event sets form1 to display: none, and form2 to display:block.

This works well in ie6, but in FF the second form is visible briefly as something loads, and then the first form is displayed again -reset with no user information.

I checked in ie6, and the form will complete through and send an email. It is not doing this in in FF - it is just resetting the form back to the original page load.

Any ideas? Thanks Jim

StupidScript

7:40 pm on May 25, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's the first form's action?
Are you using a "submit" type button or a "button" type button on the first form?
Could you post a little of the script that accepts form1's click and reveals form2?

JimHo

9:18 pm on May 25, 2007 (gmt 0)

10+ Year Member



The script is below:
first function is getprice(). This function assigns a price based on user input, and then makes form1's button display.

User then clicks form1's button, and function sf() is run:

function getprice(){

var w = (parseFloat(document.main.width.value)*1.4537)*parseFloat(document.main.wcs.value);
var x = (parseFloat(document.main.length.value) +parseFloat(document.main.width.value))*2;
x*=parseFloat(document.main.bcs.value);
var y = 0;
if (document.main.bindcorner.selectedIndex=="1"){y=parseFloat(document.main.mcs.value);}
var z=0;
if (document.main.length.value>8 && document.main.width.value>8){ z=100;}
document.main.pr.value=Math.round(w+x+y+z);
if( document.main.length.value<1 ¦¦ isNaN(document.main.length.value)){ document.main.pr.value =0;}
if( document.main.width.value<1 ¦¦ isNaN(document.main.width.value)){ document.main.pr.value =0;}
if (document.main.pr.value==0){document.main.btn1.style.display= "none";}else{document.main.btn1.style.display= "block";}
document.getElementById('rugprice').innerHTML ="Price: $" +document.main.pr.value +".00";

}

function sf() {
var l =parseFloat(document.main.length1.value +(document.main.length2.value/12));
var l1, w1
if(document.main.length2.value==0){l1=document.main.length1.value +"'"} else{l1=document.main.length1.value +"'-" +document.main.length2.value +"\"" };
var w =parseFloat(document.main.width1.value +(document.main.width2.value/12));
if(document.main.width2.value==0){w1=document.main.width1.value +"'"} else{w1=document.main.width1.value +"'-" +document.main.width2.value +"\"" };

if (l>=w) { ret=l1 + " by " +w1;}else{ret=w1 + " by " +l1;}
ret += " ";
ret += document.main.wn.value;
ret += " with ";
ret +=document.main.bindcolor[document.main.bindcolor.selectedIndex].text.toLowerCase();
ret += " ";
ret +=document.main.bindcoll[document.main.bindcoll.selectedIndex].text.toLowerCase();
ret += " border applied at ";
ret +=document.main.bindwidth[document.main.bindwidth.selectedIndex].text.toLowerCase();
ret += " with ";
ret +=document.main.bindcorner[document.main.bindcorner.selectedIndex].text.toLowerCase();
ret += ". Price quoted $";
ret += document.main.pr.value
ret += ". Quote valid for 30 days.";

document.getElementById("rugdesc").innerHTML = ret;
document.CustomRugOrder.Description.value = ret;

document.getElementById("rugorder").style.display= "block";
document.getElementById("rugdetails").style.display= "none";
document.getElementById("bindfloats").style.display="none";
document.getElementById("btextr").style.display="none";
return false;
}

edit: Sorry the button on form1 is a button, and not a submit

[edited by: JimHo at 9:20 pm (utc) on May 25, 2007]