Solved

Javascript onsubmit error

Posted on 2004-08-18
7
238 Views
Last Modified: 2011-10-03
This question follows on from this thread
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21096299.html where I have frames and need to compare a textbox on the top frame to the bottom frame on submit

in my function below - on submit I often get an error "parent.header.WizardHeader.DealerTotal.value is Null or not an Object"?? It seems to happen if teh text box on the top of my frame is null or zero but sometimes also happens with it is populated?

how do I trap the error or do some validation if null or emptystring or..

function submitClicked(){
if (parent.header.WizardHeader.DealerTotal.value == window.document.WizardDetail.OverallTotal.value) {
          window.document.WizardDetail.submit();
     }
     else{
          alert('The Totals do not match.  Please amend.');
     }
     }

</script>

Please help!
0
Comment
Question by:cgibbons123
  • 4
  • 3
7 Comments
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 50 total points
ID: 11836739
This means that the field does not exist. Keep in mind, parent.header.WizardHeader.DealerTotal.value will only work if you call the function from the child frame. Otherwise, you have to change the path to the function call.

FtB
0
 

Author Comment

by:cgibbons123
ID: 11836831
What If I know the field is there on the top Frame as follows?

Response.Write "<td><input type=textbox name='DealerTotal' size=1 onchange=ValidateInteger() maxlength=4 value=" & strTotalDealer & "></td>"

On the main frame I have a button as follows:
Response.Write("<br><input name='btnSubmit' type='button' name='Next >>' value='Next >>' onclick='submitClicked()'>") which calls

function submitClicked(){
      if (top.header.WizardHeader.DealerTotal.value == window.document.WizardDetail.OverallTotal.value) {
            window.document.WizardDetail.submit();
      }
      else{
            alert('Numbers dont match.  Please amend.');
      }
      }
</script>

Please explain further what you mean by change the path to the function call?
0
 

Author Comment

by:cgibbons123
ID: 11837670
forget this.  I was calling the page from within it self so it was reloading itself and then somehow lost the reference to the txtbox.

I changed some code and it works again.

Thanks

colin

I will try and close this question
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11841075
So, as I said, the object does not exist or you weren't referencing it correctly.

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12610058
Hey thanks for the C--I am so glad that I bothered to volunteer my time to help you out.

FtB
0
 

Author Comment

by:cgibbons123
ID: 12610356
hey

I didnt use your advise and thought I was doing you a favour by allocating you 50 points...

someone once told me that sarcasm is the lowest form of wit..
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 12610372
And C's are the lowest form of appreciation. You are only doing yourself a favour by maintaining your open questions as the EE guidelines stipulate. Anyway, it is not a big issue, but I always find it revealing when people post questions worth very few points, don't follow up, and then offer a poor grade.

FtB
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Timeout with Loop 6 59
File download script VBSCRIPT fail on download PPT files 2 68
XML and version of MS XML Dom Document versions 5 30
Hide and Unhide Table 6 24
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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