Web Analytics Made Easy -
StatCounter Netscape problems... - CodingForum

Announcement

Collapse
No announcement yet.

Netscape problems...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Netscape problems...

    Hi all...

    I have been working at this system for weeks, and I just want it done! I have tested it in Netscape and a part of it does not work. I need the information from my form to be copied into a hidden form, then posted to a new form. Thing work just fine in IE, but when I try to retrieve the info in Netscpe, it won't copy.

    So...

    Form 1 goes like this....
    <Html>
    <head>
    <script language="JavaScript">
    function copyData() {
    //copy data to hidden fields
    parent.frames[1].frmHidden.FormNum.value=document.Form.FormNum.value;
    parent.frames[1].frmHidden.PickupName.value=document.Form.PickupName.value;
    parent.frames[1].frmHidden.PickupCustomerNum.value=document.Form.PickupCustomerNum.value;
    parent.frames[1].frmHidden.PickupAddress.value=document.Form.PickupAddress.value;
    parent.frames[1].frmHidden.PickupCity.value=document.Form.PickupCity.value;
    parent.frames[1].frmHidden.PickupContact.value=document.Form.PickupContact.value;
    parent.frames[1].frmHidden.PickupPhone.value=document.Form.PickupPhone.value;

    parent.frames[1].frmHidden.DeliveryName.value=document.Form.DeliveryName.value;
    parent.frames[1].frmHidden.DeliveryCustomerNum.value=document.Form.DeliveryCustomerNum.value;
    parent.frames[1].frmHidden.DeliveryAddress.value=document.Form.DeliveryAddress.value;
    parent.frames[1].frmHidden.DeliveryCity.value=document.Form.DeliveryCity.value;
    parent.frames[1].frmHidden.DeliveryContact.value=document.Form.DeliveryContact.value;
    parent.frames[1].frmHidden.DeliveryPhone.value=document.Form.DeliveryPhone.value;


    for(i=0;i<document.Form.elements.length;++i) {
    if(document.Form.elements[i].name=="PickupType") {
    if(document.Form.elements[i].checked==true){
    //you need to refer to the element of the form you just looped through!
    parent.frames[1].frmHidden.PickupType.value=document.Form.elements[i].value;
    //parent.frames[1].frmHidden.PickupType.value=document.Form.PickupType.value;
    }
    }
    }

    for(i=0;i<document.Form.elements.length;++i) {
    if(document.Form.elements[i].name=="DeliveryType") {
    if(document.Form.elements[i].checked==true){
    //you need to refer to the element of the form you just looped through!
    parent.frames[1].frmHidden.DeliveryType.value=document.Form.elements[i].value;
    //parent.frames[1].frmHidden.DeliveryType.value=document.Form.DeliveryType.value;
    }
    }
    }
    parent.frames[1].frmHidden.Weight.value=document.Form.Weight.value;
    parent.frames[1].frmHidden.Comments.value=document.Form.Comments.value;
    }
    //Form Validation
    function validate (form) {
    r=1;
    if(confirm("Submit form now?")){


    if (form.PickupName.value =="")r=0;
    if (form.PickupCustomerNum.value =="")r=0;
    if (form.PickupAddress.value=="")r=0;
    if (form.PickupCity.value =="")r=0;
    if (form.PickupContact.value=="")r=0;
    if (form.PickupPhone.value=="")r=0;

    if (form.DeliveryName.value =="")r=0;
    if (form.DeliveryCustomerNum.value =="")r=0;
    if (form.DeliveryAddress.value=="")r=0;
    if (form.DeliveryCity.value =="")r=0;
    if (form.DeliveryContact.value=="")r=0;
    if (form.DeliveryPhone.value =="")r=0;

    if (r==0)
    { alert('Form will not be submitted because you failed to fill out all the required parts of the form.');
    return false;}
    else { return true; }


    }



    else {return false;}
    }


    function confirmReset (form) {
    if (confirm("Are you sure you want to clear the form?")) {return true}
    else {return false}
    }
    //Go to the Next Form
    function nextForm(){
    window.open("Waybill.htm", "Main");
    self.focus();
    }

    //Get my unique form number

    function UniqueString(){
    var mydate = new Date;
    var myday = mydate.getDate();
    var mymonth = mydate.getMonth()+1;
    var myyear = ((mydate.getYear() < 100) ? "19" : "") + mydate.getYear();
    var myyear = myyear.substring(2,4);
    var myhour = mydate.getHours();
    var myminutes = mydate.getMinutes();
    var myseconds = mydate.getSeconds();
    if(myday < 5) myday = "0" + myday;
    if(mymonth < 5) mymonth = "0" + mymonth;
    if(myhour < 5) myhour = "0" + myhour;
    if(myminutes < 3) myminutes = "0" + myminutes;
    if(myseconds < 3) myseconds = "0" + myseconds;
    var datearray = new Array(mymonth,myday,myyear,myhour,myminutes,myseconds);
    var uniq = "";
    for(i=0;i<datearray.length;i++){

    for(z=0;z<2;z++){
    var which = Math.round(Math.random()*1);

    if(which==0){
    x = String.fromCharCode(64 + (Math.round(Math.random()*25)+1));
    }
    else{
    x = String.fromCharCode(47 + (Math.round(Math.random()*9)+1));
    }
    uniq += x;
    }
    uniq += datearray[i];
    }
    return uniq;
    }
    function newNum(){
    var uniq=UniqueString();
    var userInput1=document.write(uniq);

    document.form.FormNum.value=userInput1;

    }
    </script>

    <h2> Instructions For Submitting:<p></h2>
    <ol><li>Fill in form<br>
    <li>Click 'Submit Query'<br>
    <li>Click 'Copy'
    <li>Click 'Next' to view the Waybill
    <li>Click 'Enter Data' to populate the tables
    <li>Print the document
    <li>Open Mail Application; press send</ol>
    </td>
    <td></td>
    </tr>
    </table>

    * Notes a required field<p>

    <input type="reset">
    <input type="submit">
    <TR><TD><Input Type="Button" onClick="copyData();" Value="Copy..."></TD>
    <TD><Input Type="Button" onClick="nextForm();" Value="Next"></TD>



    </form>

    <script language="javascript">
    document.Form.FormNum.value=UniqueString();
    </script>
    </body>
    </html>



    The hidden from goes like this.....


    <HTML>
    <Head>
    <Script Language="JavaScript">
    </Script>
    </Head>
    <Body>
    <Form Name="frmHidden">
    <Input Type="Hidden" Name="FormNum">
    <Input Type="Hidden" Name="PickupName">
    <Input Type="Hidden" Name="PickupCustomerNum">
    <Input Type="Hidden" Name="PickupAddress">
    <Input Type="Hidden" Name="PickupCity">
    <Input Type="Hidden" Name="PickupContact">
    <Input Type="Hidden" Name="PickupPhone">

    <Input Type="Hidden" Name="DeliveryName">
    <Input Type="Hidden" Name="DeliveryCustomerNum">
    <Input Type="Hidden" Name="DeliveryAddress">
    <Input Type="Hidden" Name="DeliveryCity">
    <Input Type="Hidden" Name="DeliveryContact">
    <Input Type="Hidden" Name="DeliveryPhone">

    <Input Type="Hidden" Name="PickupType">
    <Input Type="Hidden" Name="DeliveryType">
    <Input Type="Hidden" Name="Weight">
    <Input Type="Hidden" Name="Comments">
    </Form>
    </Body>
    </HTML>


    And the waybill form goes like this....


    <html>
    <head>
    <title>Waybill</title>
    <Script Language="JavaScript">
    //Get todays date

    function getDate(){
    var now=new Date


    //if statments determining what statement to display based on what hour of the day it is.
    if (now.getMonth() ==0) {Month=" 01 ";}
    if (now.getMonth() ==1) {Month=" 02 ";}
    if (now.getMonth() ==2) {Month=" 03 ";}
    if (now.getMonth() ==3) {Month=" 04 ";}
    if (now.getMonth() ==4) {Month=" 05 ";}
    if (now.getMonth() ==5) {Month=" 06 ";}
    if (now.getMonth() ==6) {Month=" 07 ";}
    if (now.getMonth() ==7) {Month=" 08 ";}
    if (now.getMonth() ==8) {Month=" 09 ";}
    if (now.getMonth() ==9) {Month=" 10 ";}
    if (now.getMonth() ==10) {Month=" 11 ";}
    if (now.getMonth() ==11) {Month=" 12 ";}


    //array drawing out Month and day
    document.write(Month+"/" +now.getDate()+ "/" +(now.getYear()+ 0000) + "<BR>");
    }


    //takes the data collected by the form, and enters it
    //into textboxes
    function enterText(){
    var userInput1=parent.frames[1].frmHidden.PickupName.value;
    var userInput2=parent.frames[1].frmHidden.PickupCustomerNum.value;
    var userInput3=parent.frames[1].frmHidden.PickupAddress.value;
    var userInput4=parent.frames[1].frmHidden.PickupCity.value;
    var userInput5=parent.frames[1].frmHidden.PickupContact.value;
    var userInput6=parent.frames[1].frmHidden.PickupPhone.value;

    var userInput7=parent.frames[1].frmHidden.DeliveryName.value;
    var userInput8=parent.frames[1].frmHidden.DeliveryCustomerNum.value;
    var userInput9=parent.frames[1].frmHidden.DeliveryAddress.value;
    var userInput10=parent.frames[1].frmHidden.DeliveryCity.value;
    var userInput11=parent.frames[1].frmHidden.DeliveryContact.value;
    var userInput12=parent.frames[1].frmHidden.DeliveryPhone.value;

    var userInput13=parent.frames[1].frmHidden.PickupType.value;
    var userInput14=parent.frames[1].frmHidden.DeliveryType.value;
    var userInput15=parent.frames[1].frmHidden.Weight.value;
    var userInput16=parent.frames[1].frmHidden.Comments.value;
    var userInput17=parent.frames[1].frmHidden.FormNum.value;

    document.myForm1.PickupName.value=userInput1;
    document.myForm1.PickupCustomerNum.value=userInput2;
    document.myForm1.PickupAddress.value=userInput3;
    document.myForm1.PickupCity.value=userInput4;
    document.myForm1.PickupContact.value=userInput5;
    document.myForm1.PickupPhone.value=userInput6;


    document.myForm1.DeliveryName.value=userInput7;
    document.myForm1.DeliveryCustomerNum.value=userInput8;
    document.myForm1.DeliveryAddress.value=userInput9;
    document.myForm1.DeliveryCity.value=userInput10;
    document.myForm1.DeliveryContact.value=userInput11;
    document.myForm1.DeliveryPhone.value=userInput12;

    document.myForm1.PickupType.value=userInput13;
    document.myForm1.DeliveryType.value=userInput14;
    document.myForm1.Weight.value=userInput15;
    document.myForm1.Comments.value=userInput16;
    document.myForm1.FormNum.value=userInput17;


    }


    </Script>
    </head>
    <Body bgcolor=#ffffcc>
    <Font size="3" face="poor richard">

    <Input Type="Button" onClick="enterText();" Value="Enter Data">



    I have only enterd the scripts for brevity...I hope someone can find the answer....

    thanks
    JamJam

  • #2
    In Netscape 4 version browsers the syntax is a little different when referencing form elements. You have to use the term "document" when referencing them like this:
    parent.frames[1].document.frmHidden.FormNum.value

    This will also work in IE. Try that and see if it corrects your problem. Good Luck.

    Comment


    • #3
      Thanks



      It worked! Thanks
      JamJam

      Comment

      Working...
      X