...

View Full Version : Any one familiar with parentNode property



bsharif
06-30-2006, 02:51 PM
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?:mad:

JUD
06-30-2006, 03:06 PM
You might want to try posting your code.

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

bsharif
06-30-2006, 03:09 PM
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. :thumbsup:

Beagle
06-30-2006, 04:01 PM
seems to me that obj.value sometimes holds a value that is not one of the names of a form field in your form

bsharif
06-30-2006, 04:41 PM
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.

Beagle
06-30-2006, 04:45 PM
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:



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;
}

bsharif
06-30-2006, 05:02 PM
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?

Beagle
06-30-2006, 05:16 PM
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.

bsharif
06-30-2006, 05:16 PM
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

:thumbsup: :thumbsup: :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum