You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Derek Hohls <DH...@csir.co.za> on 2008/10/08 15:34:07 UTC

Re: how to implement "back button functionality" from within a flow script

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 <48...@gmail.com>, Paul Joseph <pj...@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 



-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


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


Re: how to implement "back button functionality" from within a flow script

Posted by Joerg Heinicke <jo...@gmx.de>.
On 08.10.2008 16:05, Paul Joseph wrote:
> Thank you kindly for your prompt reply Derek...I surmised this was the 
> case but wanted to check with the experts...

I'm not considering myself an expert especially on AJAX, but I second 
Derek's analysis.

Joerg

> Derek Hohls 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?

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


Re: how to implement "back button functionality" from within a flow script

Posted by Paul Joseph <pj...@gmail.com>.
Thank you kindly for your prompt reply Derek...I surmised this was the 
case but wanted to check with the experts...

Oh well!

Derek Hohls 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 <48...@gmail.com>, Paul Joseph <pj...@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 
>
>
>
>   

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


Re: how to implement "back button functionality" from within a flow script

Posted by so...@apache.org.
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 <DH...@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 <48...@gmail.com>, Paul Joseph <pj...@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