Sorry for coming in late to the discussion but I only read this thread now.
I may have misunderstood the problem. I'm thinking the popup will display a list of providers matching the search parameters, and the user can select any of them by checking one, and the fields on the form on the parent window displays the values for the checked provider. And when the user selects another provider from the results, the form updates itself on the parent window. Did I get it? Well, if I'm close anyway, maybe what I'm thinking will work. I would solve this problem by having the popup concentrate on searching for a provider, and leave the problem of populating form fields to the calling (parent) window. The popup would have a reference to the parent, so I can call a JS function on the parent. With JS, even the function to call can be dynamic, so it could be a parameter that the parent window sends to the popup ("call my 'showProvider' method when the user selects a provider"). The parameter to the "showProvider" method would be the provider ID. When showProvider is called, it would send an XMLHttpRequest to retrieve the details of said provider. I'd have a method which I can call with the XML result of the call, as well as the form name or form variable, and will begin to populate the fields that it finds. With a decent naming convention, I can write this method so that I can reuse it whereever I have this form. The reusable portions would be the popup (completely parameterized), the XMLHttpRequest handling, the form population function, even the method that gets called when a provider is selected. The form names would have to match across all the pages using it. Hope this helps. Let me know if you want me to clarify any point. Sorry if I misunderstood your problem and offered a bogus solution. Hubert On 11/17/05, Preston CRAWFORD <[EMAIL PROTECTED]> wrote: > Okay, this is a little complex, so hopefully I can describe it well so > as not to confuse anyone. > > We have a need for the following. We need a reusable set of actions, > JSPs, etc. that operate in a popup to allow the user to search for a > medical provider. That's easy enough. The catch is this. The reason for > a popup is because the UI requirement is that the user perform the > search and then (as transparent as possible to them) have the page > refresh the portions of the display that say what medical provider is > currently selected. So you might have a page. In other words when the > search is performed a hidden form field will get updated (via Javascript > currently) with selected Provider ID. And then N number of fields are > going to be populated with some data to let the user know which provider > has been selected. > > The trick is that since we're using Javascript currently the Javascript > is basically statically calling form names and form fields and changing > data based on what it's getting from the search action. So something > like this. > > <script type="text/javascript" language="JavaScript"> > <!-- > function callOnloadFunctions() { > updateParentAndCloseSelf(); > } > > function updateParentAndCloseSelf() { > changeParentFormValue('medicalInfoForm', 'hospital', '<c:out > value="${chosenProvider}" />'); > changeParentDOMElement('hospitalLabel', '<c:out > value="${chosenProvider}" />'); > window.close(); > } > //--> > </script> > > Obviously problem #1 is that this JSP page can't be used on other views > because it references by name the name of the form. I'm not sure how to > dynamically get this to the JSP page without passing around a token of > some kind or passing around values in the request stream. That seems > like it could get ugly. Plus if I have to update, visually, more than > just the name of the hospital, for example, how would I handle that? > Imagining ANOTHER JSP page with separate Javascript. > > function updateParentAndCloseSelf() { > changeParentFormValue('anotherForm', 'hospital', '<c:out > value="${chosenProvider}" />'); > changeParentDOMElement('hospitalLabel', '<c:out > value="${chosenProvider}" />'); > changeParentDOMElement('hospitalAddressLabel', '<c:out > value="${chosenProvider}" />'); > changeParentDOMElement('hospitalStateLabel', '<c:out > value="${chosenProvider}" />'); > window.close(); > } > > In short, it could get REALLY ugly. > > Now another option is that we actually give in (I say give in because > it would mean a page refresh, something that might not go over well), > submit the form, but don't save the data to the database yet, and then > somehow via request or session retain any other field data they may have > changed for when we hit the page again, without saving it to the > database. > > Okay, hopefully that makes some sense. > > Basically we want a popup that performs a search, updates some data on > the page and in the form on the page, without actually doing the final > submit and save. And we'd like it to be reusable, if possible. So far we > can't think of the best way to approach this, in terms of the UI. > Hopefully someone gets the question and can help. If not I understand, > believe me. > > Preston --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]