By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,627 Members | 1,916 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,627 IT Pros & Developers. It's quick & easy.

Dynamic forms and AJAX

P: n/a
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

Nov 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

ro*********@comcast.net wrote:
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.

Nov 20 '06 #2

P: n/a

rob.horv...@comcast.net wrote:
ro*********@comcast.net wrote:
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.
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

Nov 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.