Solved

Javascript onsubmit error

Posted on 2004-08-18
7
237 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Classic ASP, Search Recordset on pick list change 1 71
Time/Date Query 11 43
Connection to multiple databases 13 25
Button on Table, name table1 not working 4 21
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 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