Thursday, March 29, 2007

Parent child forms in ASP

A month ago, I had to modify an ASP form with some functionality.

this functionality existed in another form, so I decided instead of developing or copy pasting the functionality , i would just call that form as a child in a DIV of the parent form using AJAX.

boy was that a bad decision! believe me it works, the whole form can be called in a div using ajax response.

but i ran into a weird problem that the javascript coming in the AJAX call from the child page didnt run, no matter what. even though the js was there in the AJAX response, I could see it in the debugger

I had to write whole of form validation scripting on the parent page, the elements in the child form were available by using

document.getElementById


in js. I warned another of my colleague who got a similar assignment , he wanted to do it with IFRAME element, and get calls at runtime by changing the form action for the form in the IFRAME element

eventually he ended with similar problems that I was having.

there was another problem with browser caching when using AJAX, when the user updates some values in the child form and submits it and refreshes the parent form, although the changes were reflected in database but the browser (specifically internet explorer) kept showing old values which I believe it keeps picking up from the cache.

theres a browser setting that can be set to check for the new instance of the page on every request, but that didnt seem to work either. We deployed the application with this so called "bug".

I'll post some examples related to this issue later on

No comments: