Dynamic forms and AJAX

R

rob.horvath

Ok, I'm having what is most likely a very newbie problem, but... I am
generating dynamic content for a page within a DIV on my main page (so
I have a 'content' DIV). This works very well, and all of my async
calls to server-side PHP work as expected. The problem that I am
having is when the content returned contains an HTML form. I then need
to pass this back to my XMLHttpRequest handler to get new content. The
problem is my form object is not recognized. I've even tried passing
the value in the text boxes via function calls, and I still get either
element not defined errors or element has no properties. This is in
IE/Firefox/Safari, so I know there's definitely an issue.

It seems that the main problem is that any form elements passed to the
content DIV after the page loads are inaccessible to the existing JS
framework I have in place for processing the AJAX calls. Is there
something I'm missing? Do I need to create the forms ahead of time so
they get parsed into the DOM when the page loads? Is there a way to
refresh the DOM? Do I need to access these in some other fashion,
perhaps through the content DIV in some way?

The codebase at this point is rather large, and I think this is more of
a conceptual question, but I can post some snippets if required.

Thanks,
Rob
 
R

rob.horvath

Ok, I'm having what is most likely a very newbie problem, but... I am
generating dynamic content for a page within a DIV on my main page (so
I have a 'content' DIV). This works very well, and all of my async
calls to server-side PHP work as expected. The problem that I am
having is when the content returned contains an HTML form. I then need
to pass this back to my XMLHttpRequest handler to get new content. The
problem is my form object is not recognized. I've even tried passing
the value in the text boxes via function calls, and I still get either
element not defined errors or element has no properties. This is in
IE/Firefox/Safari, so I know there's definitely an issue.

It seems that the main problem is that any form elements passed to the
content DIV after the page loads are inaccessible to the existing JS
framework I have in place for processing the AJAX calls. Is there
something I'm missing? Do I need to create the forms ahead of time so
they get parsed into the DOM when the page loads? Is there a way to
refresh the DOM? Do I need to access these in some other fashion,
perhaps through the content DIV in some way?

The codebase at this point is rather large, and I think this is more of
a conceptual question, but I can post some snippets if required.

Thanks,
Rob

Nevermind. I've found that if I pass the form object itself to the
handler function I am indeed able to then access the email. Kind of a
pain, but it works.
 
R

rob.horvath

Nevermind. I've found that if I pass the form object itself to the
handler function I am indeed able to then access the email. Kind of a
pain, but it works.

Sorry, works in FF/Safari, not in IE. Still unable to locate the child
element, even when passing the form object itself. Darn IE.. Crap,
crap, crap.

-Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top