Solved

Javascript onsubmit error

Posted on 2004-08-18
7
233 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
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.

 
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

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

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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

895 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

13 Experts available now in Live!

Get 1:1 Help Now