Solved

Problem relocating code in a table

Posted on 2008-06-22
4
689 Views
Last Modified: 2010-04-21
I have a table with two columns and three rows.  If i place my lookup box in the bottom row it works properly filling values in a table in row two.  If I move the lookup to the first row i get the error in internet explorer

Line: 154
char: 1
error: 'x.options' is null or not an object
code: 0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Orders</TITLE>

<META http-equiv=Content-Type content="text/html; charset=windows-1252"><LINK 

href="include/style.css" type=text/css rel=stylesheet>{$includes}

<META content="MSHTML 6.00.2900.3354" name=GENERATOR></HEAD>

<BODY bgColor=white {$bodyonload}>{if !$onthefly}{include_if_exists file="include/header.asp"}&nbsp;{/if}&nbsp; 
 

<FORM action=OrderHeader_add.asp method=post encType=multipart/form-data 

{$onsubmit} {$formname}>{if $onthefly}<input type=hidden name="editType" value="onthefly"><input type=hidden name="table" value="{$flytable}"><input type=hidden name="field" value="{$flyfield}"><input type=hidden name="category" value="{$flycategory}">{/if}{doevent name="AddOnLoad"}&nbsp; 

<TABLE style="WIDTH: 769px; HEIGHT: 717px" cellSpacing=0 cellPadding=0 border=0 

{if !$onthefly} align=center {/if}>

  <TBODY>

  <TR>

    <TD><B class=xtop><B class=xb1b></B><B class=xb2b></B><B class=xb3b></B><B 

      class=xb4b></B></B>

      <DIV class=xboxcontentb>

      <TABLE class=main_table cellSpacing=0 cellPadding=0 border=0>

        <TBODY>

        <TR>

          <TD width=824>

            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

              <TBODY>

              <TR>

                <TD class=upeditmenu vAlign=middle align=middle width=820 height=35>Orders, Add new record </TD></TR></TBODY></TABLE></TD>

        <TR height=28>

          <TD width=823 bgColor=white height=1></TD>

        <TR>

          <TD 

          style="PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px" 

          width=823>

            <DIV class=xboxcontent>

            <TABLE cellSpacing=0 cellPadding=4 bgColor=#b0cbf7 border=0>

              <TBODY>

              <TR>

                <TD width=730>

                  <P align=center>

                  <TABLE style="WIDTH: 609px; HEIGHT: 75px" cellSpacing=1 

                  cellPadding=1 rules=all width=609 align=center bgColor=#ebf3bc 

                  border=1>

                    <TBODY>

                    <TR>

                      <TD width=162>

                        <P align=center><FONT 

                        color=#000000>&nbsp;Account</FONT>&nbsp; </P></TD>

                      <TD width=442>&nbsp;{build_edit_control field="CustAccount" mode="add" value=$value_CustAccount}<script>

{literal}

{

document.forms.editform.value_CustAccount.disabled=true;

}

 {/literal} </script>&nbsp; 

                        Contact&nbsp;{build_edit_control field="CustContact" value=$value_CustContact  mode="add"}<script>

{literal}

{

document.forms.editform.value_CustContact.disabled=true;

}

 {/literal} </script></TD>

                    <TR>

                      <TD width=162>

                        <P align=center>&nbsp;Customer</P></TD>

                      <TD width=442>&nbsp;{build_edit_control field="CustName" mode="add" value=$value_CustName}<script>

{literal}

{

document.forms.editform.value_CustName.disabled=true;

}

 {/literal} </script></TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 610px; HEIGHT: 109px" cellSpacing=1 

                  cellPadding=1 rules=all width=610 align=center bgColor=#ebf3bc 

                  border=1>

                    <TBODY>

                    <TR>

                      <TD width=178>&nbsp; 

                        <TABLE cellSpacing=1 cellPadding=1 width=150 

                        align=center border=1>

                          <TBODY>

                          <TR>

                            <TD width=61>

                              <P align=center>Job Number</P></TD>

                            <TD width=101>&nbsp;{build_edit_control field="JobNumber" mode="add" value=$value_JobNumber}</TD>

                          <TR>

                            <TD width=61>

                              <P align=center>&nbsp;Purchase Order</P></TD>

                            <TD width=101>&nbsp;{build_edit_control field="PONumber" mode="add" value=$value_PONumber}</TD></TR></TBODY></TABLE></TD>

                      <TD width=301>&nbsp; 

                        <TABLE style="WIDTH: 281px; HEIGHT: 75px" cellSpacing=1 

                        cellPadding=1 width=281 align=center border=1>

                          <TBODY>

                          <TR>

                            <TD width=80>&nbsp;Order Date</TD>

                            <TD width=196>&nbsp;{build_edit_control field="OrderDate" mode="add" value=$value_OrderDate}</TD>

                          <TR>

                            <TD width=80>&nbsp;Due Date</TD>

                            <TD width=196>&nbsp;{build_edit_control field="DueDate" mode="add" value=$value_DueDate}</TD>

                          <TR>

                            <TD width=80>&nbsp;Due Time</TD>

                            <TD width=196>&nbsp;{build_edit_control field="DueTime" mode="add" value=$value_DueTime}</TD></TR></TBODY></TABLE></TD>

                    <TR>

                      <TD>&nbsp;Select Proof Type</TD>

                      <TD>&nbsp;Email Proof to: (Separate Multiple 

                        Addresses&nbsp; with a comma)</TD>

                    <TR>

                      <TD>&nbsp;{build_edit_control field="ProofType" value=$value_ProofType  mode="add"}</TD>

                      <TD>&nbsp;{build_edit_control field="ProofEmail" value=$value_ProofEmail  mode="add"}</TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 610px; HEIGHT: 21px" cellSpacing=1 

                  cellPadding=1 width=610 border=1>

                    <TBODY>

                    <TR>

                      <TD width=606>

                        <P align=center>(Package / Invoice Label 

                    Text)</P></TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 608px; HEIGHT: 27px" cellSpacing=1 

                  cellPadding=1 width=608 border=1>

                    <TBODY>

                    <TR>

                      <TD>&nbsp;{build_edit_control field="JobDescription" mode="add" value=$value_JobDescription}</TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 608px; HEIGHT: 21px" cellSpacing=1 

                  cellPadding=1 width=608 border=1>

                    <TBODY>

                    <TR>

                      <TD>

                        <P align=center>&nbsp;(Detailed Job 

                    Description)</P></TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 610px; HEIGHT: 27px" cellSpacing=1 

                  cellPadding=1 width=610 align=center bgColor=#ebf3bc 

                    border=1><TBODY>

                    <TR>

                      <TD width=606>&nbsp;{build_edit_control field="JobDetailDescription" mode="add" value=$value_JobDetailDescription}</TD></TR></TBODY></TABLE></P>

                  <P align=center>

                  <TABLE style="WIDTH: 610px; HEIGHT: 247px" cellSpacing=1 

                  cellPadding=1 rules=all width=610 bgColor=#d9d7fd border=1>

                    <TBODY>

                    <TR height=27>

                      <TD width=290>&nbsp;Select Product :&nbsp; {build_edit_control field="CommonProducts" value=$value_CommonProducts  mode="add"}<script>

var x = document.editform.value_CommonProducts;

x.onchange = x.onkeyup =  function(){

if (x.options[x.selectedIndex].value == 'Custom'){

var LAWidthFeet=0;

var LAWidthInch=0;

var LAWidthTotal=0;

var LAHeightFeet=0;

var LAHeightInch=0;

var LAHeightTotal=0;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal;

document.editform.value_LAHeightFeet.disabled=false;

document.editform.value_LAHeightInch.disabled=false;

document.editform.value_LAHeightTotal.disabled=false;

document.editform.value_LAWidthFeet.disabled=false;

document.editform.value_LAWidthInch.disabled=false;

document.editform.value_LAWidthTotal.disabled=false;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}

if (x.options[x.selectedIndex].value == 'Bulletin RecyclaBill'){

var LAWidthFeet=0;

var LAWidthInch=0;

var LAWidthTotal=0;

var LAHeightFeet=0;

var LAHeightInch=0;

var LAHeightTotal=0;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal+6;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal+6;

document.editform.value_LAHeightFeet.disabled=false;

document.editform.value_LAHeightInch.disabled=false;

document.editform.value_LAHeightTotal.disabled=false;

document.editform.value_LAWidthFeet.disabled=false;

document.editform.value_LAWidthInch.disabled=false;

document.editform.value_LAWidthTotal.disabled=false;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}

if (x.options[x.selectedIndex].value == 'Bulletin / Flex - 13oz Vinyl'){

var LAWidthFeet=0;

var LAWidthInch=0;

var LAWidthTotal=0;

var LAHeightFeet=0;

var LAHeightInch=0;

var LAHeightTotal=0;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal+6;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal+6;

document.editform.value_LAHeightFeet.disabled=false;

document.editform.value_LAHeightInch.disabled=false;

document.editform.value_LAHeightTotal.disabled=false;

document.editform.value_LAWidthFeet.disabled=false;

document.editform.value_LAWidthInch.disabled=false;

document.editform.value_LAWidthTotal.disabled=false;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}

if (x.options[x.selectedIndex].value == 'Bleed Paper Poster'){

var LAWidthFeet=22;

var LAWidthInch=8;

var LAWidthTotal=272;

var LAHeightFeet=10;

var LAHeightInch=5;

var LAHeightTotal=125;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal;

document.editform.value_LAHeightFeet.disabled=true;

document.editform.value_LAHeightInch.disabled=true;

document.editform.value_LAHeightTotal.disabled=true;

document.editform.value_LAWidthFeet.disabled=true;

document.editform.value_LAWidthInch.disabled=true;

document.editform.value_LAWidthTotal.disabled=true;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}

if (x.options[x.selectedIndex].value == 'Bleed RecyclaBill Poster'){

var LAWidthFeet=22;

var LAWidthInch=8;

var LAWidthTotal=272;

var LAHeightFeet=10;

var LAHeightInch=5;

var LAHeightTotal=125;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal;

document.editform.value_LAHeightFeet.disabled=true;

document.editform.value_LAHeightInch.disabled=true;

document.editform.value_LAHeightTotal.disabled=true;

document.editform.value_LAWidthFeet.disabled=true;

document.editform.value_LAWidthInch.disabled=true;

document.editform.value_LAWidthTotal.disabled=true;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}

if (x.options[x.selectedIndex].value == '8-Sheet / Junior Paper'){

var LAWidthFeet=11;

var LAWidthInch=0;

var LAWidthTotal=132;

var LAHeightFeet=5;

var LAHeightInch=0;

var LAHeightTotal=60;

document.editform.value_LAWidthFeet.value = LAWidthFeet;

document.editform.value_LAWidthInch.value = LAWidthInch;

document.editform.value_LAWidthTotal.value = LAWidthTotal;

document.editform.value_LAHeightFeet.value = LAHeightFeet;

document.editform.value_LAHeightInch.value = LAHeightInch;

document.editform.value_LAHeightTotal.value = LAHeightTotal;

document.editform.value_LAHeightFeet.disabled=true;

document.editform.value_LAHeightInch.disabled=true;

document.editform.value_LAHeightTotal.disabled=true;

document.editform.value_LAWidthFeet.disabled=true;

document.editform.value_LAWidthInch.disabled=true;

document.editform.value_LAWidthTotal.disabled=true;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_SQFootageJob.diabled=true;

}} </script></TD>

                      <TD width=315>&nbsp;Order Quantity:&nbsp; {build_edit_control field="Quantity" mode="add" value=$value_Quantity}</TD>

                    <TR height=142>

                      <TD width=290>

                        <P>&nbsp; 

                        <TABLE style="WIDTH: 72px; HEIGHT: 86px" cellSpacing=1 

                        cellPadding=1 width=72 align=left border=1>

                          <TBODY>

                          <TR>

                            <TD width=71>

                              <P align=center>Live Area</P></TD>

                            <TD width=111>

                              <P align=center>&nbsp;Feet</P></TD>

                            <TD width=112>

                              <P align=center>&nbsp;Inches</P></TD>

                          <TR>

                            <TD width=71>

                              <P align=center>&nbsp;Height</P></TD>

                            <TD width=111>&nbsp;{build_edit_control field="LAHeightFeet" mode="add" value=$value_LAHeightFeet}<script>

{literal}var x = document.editform.value_LAHeightFeet;

x.onchange = x.onkeyup =  function()

 {

var LAHeightTotal = document.editform.value_LAHeightTotal.value;

var LAHeightFeet = document.editform.value_LAHeightFeet.value;

var LAHeightInch = document.editform.value_LAHeightInch.value;

var LAWidthTotal = document.editform.value_LAWidthTotal.value;

var LAWidthFeet = document.editform.value_LAWidthFeet.value;

var LAWidthInch = document.editform.value_LAWidthInch.value;

var SQFootageJob = document.editform.value_SQFootageJob.value;

document.editform.value_LAHeightTotal.value = parseFloat(LAHeightFeet) *12 + parseFloat(LAHeightInch)+6;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_LAHeightTotal.disabled=true;

document.forms.editform.value_SQFootageJob.diabled=true;

}

 {/literal} </script></TD>

                            <TD width=112>&nbsp;{build_edit_control field="LAHeightInch" mode="add" value=$value_LAHeightInch}<script>

{literal}

var x = document.editform.value_LAHeightInch;

x.onchange = x.onkeyup =  function()

 {

var LAHeightTotal = document.editform.value_LAHeightTotal.value;

var LAHeightFeet = document.editform.value_LAHeightFeet.value;

var LAHeightInch = document.editform.value_LAHeightInch.value;

var LAWidthTotal = document.editform.value_LAWidthTotal.value;

var LAWidthFeet = document.editform.value_LAWidthFeet.value;

var LAWidthInch = document.editform.value_LAWidthInch.value;

document.editform.value_LAHeightTotal.value = parseFloat(LAHeightFeet) *12 + parseFloat(LAHeightInch)+6;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_LAHeightTotal.disabled=true;

document.forms.editform.value_SQFootageJob.diabled=true;

}

 {/literal} </script></TD>

                          <TR height=27>

                            <TD width=71>

                              <P align=center>&nbsp;Width</P></TD>

                            <TD width=111>&nbsp;{build_edit_control field="LAWidthFeet" mode="add" value=$value_LAWidthFeet}<script>

{literal}

var x = document.editform.value_LAWidthFeet;

x.onchange = x.onkeyup =  function()

 {

var LAHeightTotal = document.editform.value_LAHeightTotal.value;

var LAHeightFeet = document.editform.value_LAHeightFeet.value;

var LAHeightInch = document.editform.value_LAHeightInch.value;

var LAWidthTotal = document.editform.value_LAWidthTotal.value;

var LAWidthFeet = document.editform.value_LAWidthFeet.value;

var LAWidthInch = document.editform.value_LAWidthInch.value;

document.editform.value_LAWidthTotal.value = parseFloat(LAWidthFeet) *12 + parseFloat(LAWidthInch)+6;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_LAWidthTotal.disabled=true;

document.forms.editform.value_SQFootageJob.diabled=true;

}

 {/literal} </script></TD>

                            <TD width=112>&nbsp;{build_edit_control field="LAWidthInch" mode="add" value=$value_LAWidthInch}<script>

{literal}

var x = document.editform.value_LAWidthInch;

x.onchange = x.onkeyup =  function()

 {

var LAHeightTotal = document.editform.value_LAHeightTotal.value;

var LAHeightFeet = document.editform.value_LAHeightFeet.value;

var LAHeightInch = document.editform.value_LAHeightInch.value;

var LAWidthTotal = document.editform.value_LAWidthTotal.value;

var LAWidthFeet = document.editform.value_LAWidthFeet.value;

var LAWidthInch = document.editform.value_LAWidthInch.value;

document.editform.value_LAWidthTotal.value = parseFloat(LAWidthFeet) *12 + parseFloat(LAWidthInch)+6;

document.editform.value_SQFootageJob.value = (parseFloat((LAHeightFeet)*12)+parseFloat(LAHeightInch))*(parseFloat((LAWidthFeet)*12)+parseFloat(LAWidthInch))/12/12;

document.forms.editform.value_LAWidthTotal.disabled=true;

document.forms.editform.value_SQFootageJob.diabled=true;

}

 {/literal} </script></TD></TR></TBODY></TABLE></P></TD>

                      <TD width=315>&nbsp; 

                        <TABLE style="WIDTH: 299px; HEIGHT: 136px" cellSpacing=1 

                        cellPadding=1 width=299 align=center border=1>

                          <TBODY>

                          <TR height=116>

                            <TD width=295>

                              <P align=center>Kramer Graphics &nbsp;Standard 

                              Finish Size - Please indicated any devications in 

                              Job Detailed Description</P>

                              <P>&nbsp;&nbsp; {build_edit_control field="LAHeightTotal" value=$value_LAHeightTotal  mode="add"}&nbsp;inches 

                              in&nbsp;height by </P>

                              <P align=left>&nbsp;&nbsp;&nbsp;{build_edit_control field="LAWidthTotal" mode="add" value=$value_LAWidthTotal}&nbsp;inches 

                              in&nbsp;Width</P>

                              <P align=left>&nbsp;&nbsp; {build_edit_control field="SQFootageJob" value=$value_SQFootageJob  mode="add"}&nbsp;Single 

                              Image Sq Footage</P></TD></TR></TBODY></TABLE></TD>

                    <TR height=42>

                      <TD width=290></TD>

Open in new window

0
Comment
Question by:rmardis
  • 3
4 Comments
 
LVL 4

Accepted Solution

by:
Meritor earned 500 total points
ID: 21841054
See, this happens if the object has not been yet loaded by the browser and the script executed before that.
If you put your code in the frist line, and your object 'x' is below that, it will give u similar error.
and if you put the your script after the object, it will run perfectly
0
 

Author Comment

by:rmardis
ID: 21841065
Since I have to have this lookup before the object that is diplaying the values is there a work around to this problem short of putting the lookup after the display object
0
 

Author Comment

by:rmardis
ID: 21864850
I believed this was the case but how do i fix it
0
 

Author Closing Comment

by:rmardis
ID: 31469535
My Stupidity!!
I didn't realize what you had told me.  I relocated the script to follow in the code.  It Works!!!
So sorry I didn't realize what I needed to do.  Thank you and sorry it took me so long to realize.

Excellent work!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 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

19 Experts available now in Live!

Get 1:1 Help Now