Let me see if I can simplify this. I have delved into window.js and I'm 
trying to understand how it works - it seems to issue the AjaxRequest, 
and then take the output of that and place it into the popup. This 
populates the popup with my form. Once the user fills it out and submits 
it, a POST request is sent to the server. This is recv'd and processed 
fine on the server. The response from the server then is what is 
displayed on the main window(after the popup has closed). This is what 
I'd like to avoid. Is there a way to possibly intercept this response 
and not display it in the main window. All options are on the table - 
utilizing the provided API, or modifying it - whatever. Is this even 
possible?

Any help or insight much appreciated...

Tom


> Thanks for your help Felix...
>
> Felix Shnir wrote:
>> Tom, it depends on how you are processing the form,
> I'm handling it within the symfony action - i.e., posted to the 
> server. The action take the values from the form to the model to the 
> db. It seems what I have in the js window is nested forms - the form 
> that comes as a result of the AjaxRequest Get, within the Dialog /PWC 
> form control - so - if I submit the inner form, the db is updated 
> correctly, the js window closes, but the inner form html ends up in 
> the parent window; BUT -  if I submit the outer form, then the db is 
> not updated correctly, but the js window closes, and the parent window 
> retains its original content. Confusing enough? These are complicated 
> forms that have ten or twenty fields, with toggles and hidden divs, 
> etc., - so I don't relish trying to rebuild them from within a js 
> definition....
>
> I can get around it by redirecting back to the original at the end of 
> the action, but that ends up requiring more tailored code each time I 
> use this....including trying to track and retain intermediate selected 
> form values for redisplay....
>
>> I usually set up a return function to handle it, not observer:
>> Dialog.confirm("<br><div id=\"login_popup\"><\/div>", 
>> {windowParameters: {className:"alphacube", width:300, height:235}, 
>> okLabel: "proceed", ok: Login.doLogin });
>> But in a PWC, you can set up additional buttons to do the onclick 
>> event to handle your processing.  onDestroy is also useful if oyu 
>> choose to go that route.  Do not set win to null though, PWC will 
>> handle destruction of a window.
>>
>> Felix.
>>
>>
>> On 11/25/06, *Tom Cowin* <[EMAIL PROTECTED] 
>> <mailto:[EMAIL PROTECTED]>> wrote:
>>
>>     Is there a formula for successfully processing a form within a 
>> window,
>>     where the form is retrieved by an AjaxRequest? In my own
>>     convoluted way,
>>     I have it working to the point that the form is displayed, then
>>     handled
>>     and submitted properly, but I'm not able to capture (or block) the
>>     return from the form submission. This is within the context of the
>>     symfony environment.
>>
>>     <script type="text/javascript">
>>        var win;
>>
>>     function test()
>>     {
>>            var currentTime = new Date();
>>            var id = "window_id_" + currentTime.getTime();
>>            win = new Window(id, {className: "dialog", width:450,
>>     height:680,
>>     zIndex: 100, title: "create customer"});
>>            win.setAjaxContent("/index.php/customer/createJSW", {method:
>>     'get'}, true, true);
>>     }
>>
>>     myObserver = {
>>                onDestroy:
>>                    function(eventName, win1) {
>>                        if (win1 == win) {
>>                            win = null;
>>                            self.location.reload();
>>                            Windows.removeObserver(this);
>>                            }
>>                        }
>>                    }
>>            Windows.addObserver(myObserver);
>>        </script>
>>
>>
>>        <a class="ancillary" href="#" onclick="test();return false;">[add
>>     customer]</a>
>>
>>     I'd also like to be able to reload the primary window once the js
>>     window
>>     is closed/destroyed - I assume the best way to handle this is via an
>>     observer?
>>
>>     _______________________________________________
>>     Javawin mailing list
>>     [email protected] <mailto:[email protected]>
>>     http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Javawin mailing list
>> [email protected]
>> http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
>>   
>
>

_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com

Reply via email to