AnsweredAssumed Answered

Passing Arguments for Components

Question asked by jcobb on Aug 15, 2009
Latest reply on Aug 16, 2009 by jcobb
Not strictly share development - I'm working on a surf application. I'm pretty new to the idea of components / dashlets / widgets etc.

Let's say I have a component that's a clock, and it can display time either digital or analogue. I can use post or get arguments to change the display. I also have another component, for example a login panel that posts username and password to a webscript to log the user in.

My question is this  - is there a best practice way of passing arguments (eg which type of clock to display) across page reloads, so that components can persist their state and remain independent of what's happening with other components?

I created a register component for surf - my first attempt had the webscript that processes the form data redirecting back to the calling page with success or error codes in the url (eg ?registerError=No username). Realising that either other components won't then persist their state if they rely on the url, or the url will get permanently over crowded, I tried storing these codes and messages as properties of the component I was redirecting back to. Which worked fine,and I was mighty proud of my work until I realised of course this isn't session specific, so will stop working when the second user logs on! :(

So - with all those 'portlets' out there, there must be some recognised ways of persisting component session data without using the url or POST data. How best do we do this in surf?

I've looked at the share source code briefly hoping for an answer, but in share the post urls for forms etc are all obscured by the yahoo gui, which I'm not familiar with.

Any thoughts appreciated. I've got the bones of my surf application - home page, login component, register component, but before I go much further I'd like to make sure I have a sensible architecture in place.

James Cobb

Outcomes