Solved

Javascript onsubmit error

Posted on 2004-08-18
7
232 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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 …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

12 Experts available now in Live!

Get 1:1 Help Now