Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Any one familiar with parentNode property

    Hello to all, is any one familiar with the parent node property. Getting an error message when running code:

    "parent node is null or not an object :


    only displays this when user does not imput any information . Can parent node recieve a NULL value?

  • #2
    JUD
    JUD is offline
    New Coder
    Join Date
    Jul 2005
    Location
    I'm right here
    Posts
    92
    Thanks
    0
    Thanked 2 Times in 2 Posts
    You might want to try posting your code.

    It will make it easier for people to help you if they can see your code

  • #3
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    if (obj.value){
      						 	hold_value=obj.form[obj.value].parentNode;
      							hold_value.style.visibility=''visible'';
      							hold_value.style.left=(countPos(obj)[0]+100)+''px'';
      							hold_value.style.top=(countPos(obj)[1])+''px'';
    						 	userInput = new String();
    							userInput = this.UpdateDataRequest.p_method_of_delivery.value;
       							document.UpdateDataRequest.p_ftp_user.value ="";
    							document.UpdateDataRequest.p_ftp_password.value ="";
    							document.UpdateDataRequest.p_ftp_host.value ="";
     						 }
     						  	obj.hold_value=hold_value;
    						 }
    basically the statement is a hidden field and 3 textfields appear when the user chooses a certain option from a drop down list.

  • #4
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    seems to me that obj.value sometimes holds a value that is not one of the names of a form field in your form

  • #5
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Still giving error message, dont get me wrong the program works completely fine compiles and runs . just gives error message when the brower sees the page at the bottom of the screen.

  • #6
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    I never suggested you have a syntax error.

    You're dynamically referencing an object with a string value, and I contend that in doing so, you are attempting to reference a non-existent object. Try this:

    Code:
      if (obj.value)
      {
        if (!obj.form[obj.value] || !obj.form[obj.value].parentNode)
          alert("This is the problem, trying to access the field: " + obj.value);
    
        hold_value=obj.form[obj.value].parentNode;
        hold_value.style.visibility=''visible'';
        hold_value.style.left=(countPos(obj)[0]+100)+''px'';
        hold_value.style.top=(countPos(obj)[1])+''px'';
        userInput = new String();
        userInput = this.UpdateDataRequest.p_method_of_delivery.value;
        document.UpdateDataRequest.p_ftp_user.value ="";
        document.UpdateDataRequest.p_ftp_password.value ="";
        document.UpdateDataRequest.p_ftp_host.value ="";
      }
    
      obj.hold_value=hold_value;
    }

  • #7
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah when i inserted your code alert pops up so that means that no value is being insert correct , so how do i correct problem?

  • #8
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    I think you're going to have to give us more code, because right now, the only answer I can give is to stop making the value of obj.value something that's not a name of a field in your form, which is not a very helpful answer.

    I think you're just doing something very strange with your logic that you don't need to do. Post your code and provide an explanation of what you're trying to accomplish.

  • #9
    New Coder
    Join Date
    Jun 2006
    Posts
    46
    Thanks
    0
    Thanked 0 Times in 0 Posts
    FOUND OUT PROBLEM THANKS

    SIMPLE ERROR , INITIALED VARIABLE TO "" ERROR LEFT ....

    Beagle WHEN YOU SENT ME THAT CODE THE ALERT TOLD ME WHAT VALUE THAT NEED TO BE INITIALIZED THANKS



  •  

    Posting Permissions

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