SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    873
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Table generated but not seen via validation

    Dear All,
    I have a link here http://183.78.169.54/v3/addCVC.php. First if you select the name T1 via ajax the second drop down list is populated. Then pick anyvalue from the second drop down list and your will get a table populated below it. Then finally when you press submit button I call the validation function. In there I got this little codes.The alert keep showing me null even though the table is generated with its relevant values too. What is the problem ya?


    Code:
    var table = document.getElementById("listOfCorrection"); 
    //var checkbox = table.getElementsByTagName("input");
    alert("tableContent:"+table);

  2. #2
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does the table exist in the DOM when you make that call? It looks like when you click the submit button (which is when you get that alert), you're deleting the table from the DOM which would in turn give you null...

  3. #3
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    873
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Mike,
    I check via the firebug in firefox yes the table is shown to me. So how to make sure the table is not deleted?

  4. #4
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    873
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Here is my page http://183.78.169.54/v3/addCVC.php. First your select T1 from the first drop down list then the second drop down list will be populated then from the second drop down list you can select any value and you will get a table. This talble is where I reference in the validation function. Thank you.

  5. #5
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    Here is my page http://183.78.169.54/v3/addCVC.php. First your select T1 from the first drop down list then the second drop down list will be populated then from the second drop down list you can select any value and you will get a table. This talble is where I reference in the validation function. Thank you.
    The reason why you are getting null is because that section of the page no longer exists, so that is no longer any element with the id that you are looking for.

    Why does is no longer exist? It's due to this assignment which removes the content:

    Code:
    if(clientViolationCorrectionControl.innerHTML="")
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #6
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    873
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Thanks that helped.
    Last edited by paul_wilkins; Jul 27, 2011 at 18:27. Reason: rest of comment relevant to other thread.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •