Solved

Javascript onsubmit error

Posted on 2004-08-18
7
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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 informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 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