You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Colin Paul Adams <co...@colina.demon.co.uk> on 2004/07/27 11:19:46 UTC

How can I stop user revisiting a CForm with the Back button?

When a users submits a CForm sucessfully (without validation errors),
and the folowscript then saves the document, I would like to prevent,
or at least catch, any attempt to go back to the form using the
browser's back button.

I suspect this can be done in some way by invalidating a
webcontinuation object, and catching an exception, but I'm not sure
which continuation to invalidate. Notr what the exception would be.

Any help?
-- 
Colin Paul Adams
Preston Lancashire

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


ResourceNotFoundException

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ugo" == Ugo Cei <u....@cbim.it> writes:

    Ugo> It's right there in the main sitemap of the sample webapp:

    Ugo>      <map:handle-errors> <map:select type="exception">

    Ugo>          ...  <map:when test="invalid-continuation">
    Ugo> <map:generate type="notifying"/> <map:transform
    Ugo> src="stylesheets/system/error2html.xslt"> <map:parameter
    Ugo> name="contextPath" value="{request:contextPath}"/>
    Ugo> <map:parameter name="pageTitle" value="Invalid
    Ugo> Continuation"/> </map:transform> <map:serialize
    Ugo> status-code="404"/> </map:when>

Oh thanks.
Pity that selector isn't documented in the usef manual.

Anyway, that works fine - at least, the invalid-continuation does.
I thought it was about time I put in a user-friendly URL not Found
page.
But not matter what I do, I cannot trap that exception. I copied the
error handler into my site-map, and then I started to play with the
not-found branch.

But this is totally ignored! I even tried redefining the exception
selector in my sitemap, but this has no effect.
It's as if there's a hard-wired ResourceNotFoundException handler that
can't be touched.
-- 
Colin Paul Adams
Preston Lancashire

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


Re: How can I stop user revisiting a CForm with the Back button?

Posted by Gunter D'Hondt <gu...@sofico.be>.
thru javascript "history.forward();" on every page (so when the 
back-button is used it automatically does a forward again; and browsers 
like IE uses caching for this so there is no server action triggered
Gunter




Ugo Cei <u....@cbim.it> 
27/07/2004 14:27
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
Re: How can I stop user revisiting a CForm with the Back button?






Colin Paul Adams wrote:
> That doesn't actually prevent the back button returning to the form.
> What id does do, however, is when the user submits the form, it throws
> an org.apache.cocoon.components.flow.InvalidContinuationException:

Right. If you want to block completely the usage of the back button, 
you'll have to play with client-side caching and browser differences and 
the like. There was a thread on this issue some time ago on this list, 
but I didn't follow it since I don't think it's worth the hassle.

> I can't seem to catch this in the flowscript. Is there a way to catch
> it in the sitemap? I thought about a map:error-handler, but reading
> the documentation, it only seems to handle HTTP status codes - not
> cocoon excpetions.

It's right there in the main sitemap of the sample webapp:

     <map:handle-errors>
       <map:select type="exception">

         ...
 

         <map:when test="invalid-continuation">
           <map:generate type="notifying"/>
           <map:transform src="stylesheets/system/error2html.xslt">
             <map:parameter name="contextPath" 
value="{request:contextPath}"/>
             <map:parameter name="pageTitle" value="Invalid 
Continuation"/>
           </map:transform>
           <map:serialize status-code="404"/>
         </map:when>


Ugo

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



Re: How can I stop user revisiting a CForm with the Back button?

Posted by Ugo Cei <u....@cbim.it>.
Colin Paul Adams wrote:
> That doesn't actually prevent the back button returning to the form.
> What id does do, however, is when the user submits the form, it throws
> an org.apache.cocoon.components.flow.InvalidContinuationException:

Right. If you want to block completely the usage of the back button, 
you'll have to play with client-side caching and browser differences and 
the like. There was a thread on this issue some time ago on this list, 
but I didn't follow it since I don't think it's worth the hassle.

> I can't seem to catch this in the flowscript. Is there a way to catch
> it in the sitemap? I thought about a map:error-handler, but reading
> the documentation, it only seems to handle HTTP status codes - not
> cocoon excpetions.

It's right there in the main sitemap of the sample webapp:

     <map:handle-errors>
       <map:select type="exception">

         ...
 

         <map:when test="invalid-continuation">
           <map:generate type="notifying"/>
           <map:transform src="stylesheets/system/error2html.xslt">
             <map:parameter name="contextPath" 
value="{request:contextPath}"/>
             <map:parameter name="pageTitle" value="Invalid Continuation"/>
           </map:transform>
           <map:serialize status-code="404"/>
         </map:when>


Ugo

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


Re: How can I stop user revisiting a CForm with the Back button?

Posted by Colin Paul Adams <co...@colina.demon.co.uk>.
>>>>> "Ugo" == Ugo Cei <ug...@apache.org> writes:

    Ugo> Il giorno 27/lug/04, alle 11:19, Colin Paul Adams ha scritto:
    >> When a users submits a CForm sucessfully (without validation
    >> errors), and the folowscript then saves the document, I would
    >> like to prevent, or at least catch, any attempt to go back to
    >> the form using the browser's back button.
    >> 
    >> I suspect this can be done in some way by invalidating a
    >> webcontinuation object, and catching an exception, but I'm not
    >> sure which continuation to invalidate. Notr what the exception
    >> would be.
    >> 

    Ugo> var kont = form.showForm("..."); kont.invalidate();

That doesn't actually prevent the back button returning to the form.
What id does do, however, is when the user submits the form, it throws
an org.apache.cocoon.components.flow.InvalidContinuationException:

I can't seem to catch this in the flowscript. Is there a way to catch
it in the sitemap? I thought about a map:error-handler, but reading
the documentation, it only seems to handle HTTP status codes - not
cocoon excpetions.
-- 
Colin Paul Adams
Preston Lancashire

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


Re: How can I stop user revisiting a CForm with the Back button?

Posted by Ugo Cei <ug...@apache.org>.
Il giorno 27/lug/04, alle 11:19, Colin Paul Adams ha scritto:

> When a users submits a CForm sucessfully (without validation errors),
> and the folowscript then saves the document, I would like to prevent,
> or at least catch, any attempt to go back to the form using the
> browser's back button.
>
> I suspect this can be done in some way by invalidating a
> webcontinuation object, and catching an exception, but I'm not sure
> which continuation to invalidate. Notr what the exception would be.
>

var kont = form.showForm("...");
kont.invalidate();

-- 
Ugo Cei - http://beblogging.com/