[Proto-Scripty] Re: How to Serialize an object to JSON?

2009-05-31 Thread david

Hi sshah,

One simple question, when you say 
However, the problem is
maintaining this information across requests

one question is comming: Do you AJAX?? or not ??

If, as I think, it's no, I think the problem is much more complicate
than storing the object in a cookie.Because I'm not sure that
deserializing the cookie information will give you the DOM-object
where you can use the close() method (as a n exemple). But I can be
wrong, in fact I never try :((

But what you could be able to do is opening a private window that
will only contain the saved window Objects. So using the method I give
you, you'll just need to save the saved name of each windows and when
the page need the object, just request it to the private window.

If folks have a better idea :))

--
david

On 29 mai, 14:02, Suneet Shah suneetshah2...@gmail.com wrote:
 Hi David

 Thanks for the reply. You are right that we can save the window variable
 in an array and that works just fine.  However, the problem is
 maintaining this information across requests.
 ie. I can open the window on 1 page and click on the close window link
 a few requests later.

 Is there a way to keep the windowList across requests? If so, that would
 solve the problem. I was trying to searlize the object and store it as a
 cookie to get around this.

 Thanks
 Suneet

 david wrote:
  Hi sshah,

  I've never done that, but isn't there a way to save the window name
  instead and close a windows depending on it's name after??
  That could do something like that:

  var windowHandle = ;
  var windowList={};
  var windowNumber=1;

   function openWindow2(URL) {
         var windowId='capswin'+(windowNumber++)
          windowHandle = window.open
  (URL,windowId,'toolbar=no,resizable=1')
  //        var windowStr = Object.toJSON(windowHandle);
          windowList[windowId]=windowHandle
          document.cookie = iamWindowManager= + windowId;
   }

  and so you could remove the window by checking its name, get the
  window object corresponding (which is saved in the windowList
  parameter) and close the window when needed??

  --
  david

  On 28 mai, 23:39, sshah suneetshah2...@gmail.com wrote:

  Hello

  I need to serialize an object to JSON, but the following code returns:

  Stack overflow at line: 547

  var windowHandle = ;

   function openWindow2(URL) {
          windowHandle = window.open(URL,'capswin','toolbar=no,resizable=1')
          var windowStr = Object.toJSON(windowHandle);
          document.cookie = iamWindowManager= + windowStr;
   }

  How can I serialize the wiindowHandle object?

  I am trying to maintain a list of window objects in the cookie so that
  I can close all open windows when the main windows closes. If there is
  a better way to do this, please let me know.

  thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to Serialize an object to JSON?

2009-05-29 Thread david

Hi sshah,

I've never done that, but isn't there a way to save the window name
instead and close a windows depending on it's name after??
That could do something like that:

var windowHandle = ;
var windowList={};
var windowNumber=1;

 function openWindow2(URL) {
   var windowId='capswin'+(windowNumber++)
windowHandle = window.open
(URL,windowId,'toolbar=no,resizable=1')
//var windowStr = Object.toJSON(windowHandle);
windowList[windowId]=windowHandle
document.cookie = iamWindowManager= + windowId;
 }

and so you could remove the window by checking its name, get the
window object corresponding (which is saved in the windowList
parameter) and close the window when needed??

--
david

On 28 mai, 23:39, sshah suneetshah2...@gmail.com wrote:
 Hello

 I need to serialize an object to JSON, but the following code returns:

 Stack overflow at line: 547

 var windowHandle = ;

  function openWindow2(URL) {
         windowHandle = window.open(URL,'capswin','toolbar=no,resizable=1')
         var windowStr = Object.toJSON(windowHandle);
         document.cookie = iamWindowManager= + windowStr;
  }

 How can I serialize the wiindowHandle object?

 I am trying to maintain a list of window objects in the cookie so that
 I can close all open windows when the main windows closes. If there is
 a better way to do this, please let me know.

 thanks in advance
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: How to Serialize an object to JSON?

2009-05-29 Thread Suneet Shah

Hi David

Thanks for the reply. You are right that we can save the window variable 
in an array and that works just fine.  However, the problem is 
maintaining this information across requests.
ie. I can open the window on 1 page and click on the close window link 
a few requests later.

Is there a way to keep the windowList across requests? If so, that would 
solve the problem. I was trying to searlize the object and store it as a 
cookie to get around this.

Thanks
Suneet


david wrote:
 Hi sshah,

 I've never done that, but isn't there a way to save the window name
 instead and close a windows depending on it's name after??
 That could do something like that:

 var windowHandle = ;
 var windowList={};
 var windowNumber=1;

  function openWindow2(URL) {
var windowId='capswin'+(windowNumber++)
 windowHandle = window.open
 (URL,windowId,'toolbar=no,resizable=1')
 //var windowStr = Object.toJSON(windowHandle);
 windowList[windowId]=windowHandle
 document.cookie = iamWindowManager= + windowId;
  }

 and so you could remove the window by checking its name, get the
 window object corresponding (which is saved in the windowList
 parameter) and close the window when needed??

 --
 david

 On 28 mai, 23:39, sshah suneetshah2...@gmail.com wrote:
   
 Hello

 I need to serialize an object to JSON, but the following code returns:

 Stack overflow at line: 547

 var windowHandle = ;

  function openWindow2(URL) {
 windowHandle = window.open(URL,'capswin','toolbar=no,resizable=1')
 var windowStr = Object.toJSON(windowHandle);
 document.cookie = iamWindowManager= + windowStr;
  }

 How can I serialize the wiindowHandle object?

 I am trying to maintain a list of window objects in the cookie so that
 I can close all open windows when the main windows closes. If there is
 a better way to do this, please let me know.

 thanks in advance
 
 

   

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~--~~~~--~~--~--~---