|
Ok, here's what I'm trying to do or at least what I've done up to this point.
I've got AJAX to dynamically create me a form called 'pageform' within a <div>. Meaning that the form itself was never part of the source code on the original page, rather the form was generated by an external file that validated the PHP and sent via xmlHttp.responseText into the div.
So - I have a form inside a div.
Now I've filled in some details on this form in the div and click 'Send'. Another AJAX function takes over and tries to isolate each of the values I've entered in the form.
The problem arises that as the elements inside the form in the div were not part of the original document, I can't seem to use:
var password=document.pageform.password.value;
The div they're inside is called 'pagediv' the form thats generated is called 'pageform' the input is called 'password'.
So I tried something like this (pretty much knowing it wouldn't work):
var password=document.getElementById('pagediv').passwo rd.value;
So now what I'm asking is if anyone knows how to get the parentage of a form element, no matter where it may be, if its in the original source code, or if it was generated dynamically - so that I know what to put in to isolate the form elements I want in the .js file.
If any of you have any idea how I can get the parentage of the form elements within the div then please let me know. I've looked into layers and Level 1 DOM's but have no idea if I'm on the right track.
Last edited by Petsmacker; 11-28-2008 at 02:04 PM..
|