cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solprovi...@apache.org
Subject Re: how to implement "back button functionality" from within a flow script
Date Fri, 10 Oct 2008 15:50:15 GMT
I agree with Derek.  This post pretends I am a flowscript guru.

Variables persist in a continuation.  Inside the loop, only update
what needs updating i.e. if the list does not require updating, use
the existing list.  Good programming only runs what is necessary.

var done = false;
var key= "firstKey"
var list = getList(key);
do(
   form.showForm("myForm");
   var model = form.getModel();
   if(key != model.key){
      key = model.key;
      list = getList(key);
   }else{
      done = validate(form);
   }
}while(!done);

ANECDOTE: I once optimized a program by removing a loop for each
record in a database containing a function that did nothing. 30,000
records in the TEST database = 30,000 wasted database accesses.

ANECDOTE: I recently consulted on the design of a proposed
application.  The original design used AJAX to update dropdowns as
previous dropdowns were selected.  My suggestion was to make the
application work using onChange submits and worry about AJAX after the
application was approved.  Why waste effort building an interactive UI
when the company was uncertain that the base functionality was wanted?
 Even if the application was approved, refreshes for the onChange
submits might be fast/good enough for production

NOTE: AJAX allows new functionality, but breaks the BACK button.  All
the arguments against Flash apply.  I hate pages using JavaScript
functions for basic links.  Most Web applications should avoid
technology that prevents bookmarking and opening links into a new
window/tab.  (Ever want to open several menu links but the menu uses
JavaScript or Flash?)

HTH,
solprovider


On 10/8/08, Derek Hohls <DHohls@csir.co.za> wrote:
> Paul
>
>  The short answer is, AFAIK, probably "no".  That said, I am sure there are some
>  flowscript gurus who might show a way to do this with continuations?
>
>  The right answer might be "don't"  i.e. if a user has changed an item in a list,
>  why take him back to a previous version of the list which will not show his changes?
>
>  An alternative longer answer might be that you need to use some clever browser-side
>  Javascript to manipulate the list values *inside the page it is displayed* (i.e. do
not
>  send the user off to a new page with another form) to make it appear like an
>  "instant" change while, in the background, you use AJAX to send off the changed
>  value.  Without knowing more about the specifics of where you get the data from,
>  where it goes to, and how it is validated etc. its not possible to flesh this out further.
>
>  Sidebar: I have come across a number of articles recently which point out how poor
>  the web is for dynamic applications and yet that seems to be what we are forcing
>  ourselves to tackle.  Square pegs in round holes?
>
>  Derek
>
>  >>> On 2008/10/08 at 03:14, in message <48ECB252.7060100@gmail.com>,
Paul Joseph <pjoseph@gmail.com> wrote:
>  Hi There,
>
>  Would anyone know how from within a flowscript, I can cause the browser
>  to do a simple "back"?
>
>  I have a page that contains a list and which, if the list is large can
>  take a minute to build.  Usually the list is not big, but on occasion it is.
>
>  When someone clicks on an item in the list, they are put into a edit
>  form where they can edit the contents of the list.
>
>  When they hit save, currently, they are sent back to the list WHICH IS
>  REBUILT FROM SCRATCH.
>
>  Is there anyway for me to specify in the flow script to do a "simple
>  back button on browser click" so that the list is NOT built from scratch.
>
>  Thx.
>  Paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message