You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sigbjørn Tvedt <si...@gmail.com> on 2011/04/07 09:22:35 UTC

Re: Modalbox Integration Example

Hi Taha.

Thank you for sharing the code.

If I could suggest a improvement, I would recommend adding onClick="return
false;" to the generated link.
Just change the line
      writer.element("a", "href", "#", "id", getClientId());
to
      writer.element("a", "href", "#", "id", getClientId(), "onClick",
"return false;");

This will stop the browser from following the link after you have clicked
it.

Regards
Sigbjørn Tvedt


On Fri, Mar 25, 2011 at 17:20, Taha Hafeez <ta...@gmail.com> wrote:

> also, you need to add
>
> this.event("onContentLoaded");
>
> at the end of the loadContent method of Modalbox
>
> I am trying a few tricks, so that modalbox.js is not modified...
>
> taha
>
>
> On Fri, Mar 25, 2011 at 8:49 PM, Taha Hafeez <tawus.tapestry@gmail.com
> >wrote:
>
> > Hi Jim,
> >
> > This is the modified javascript to include zone updates
> >
> > ModalBoxInit = Class.create( {
> >
> >    /* Initialize Function */
> >    initialize : function(spec) {
> >       var options = spec.params;
> >       if (spec.type == "page") {
> >          Event.observe($(spec.id), spec.event, function() {
> >             Modalbox.show(spec.href, options);
> >          });
> >       } else {
> >          Event.observe($(spec.id), spec.event, function() {
> >             var successHandler = function(transport) {
> >                var node = new Element('div')
> >                      .update(transport.responseJSON.content);
> >                options.onContentLoaded = function() {
> >                   Tapestry.loadScriptsInReply(transport.responseJSON,
> > function() {
> >                   });
> >                };
> >                Modalbox.show(node, options);
> >             }.bind(this);
> >
> >             Tapestry.ajaxRequest(spec.href, {
> >                method : 'get',
> >                onSuccess : successHandler
> >             });
> >          }.bind(this));/* Event.observe */
> >       }
> >    }
> > });
> >
> > regards
> > Taha
> >
> >
> > On Fri, Mar 25, 2011 at 5:03 PM, Jim O'Callaghan <jc1000001@yahoo.co.uk
> >wrote:
> >
> >> This looks very handy Taha thanks for sharing - I'm thinking of trying
> it
> >> in
> >> a page and was wondering if you had gotten around to posting the support
> >> for
> >> zone updates anywhere? Thanks.
> >>
> >> Regards,
> >> Jim.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >
>

Re: Modalbox Integration Example

Posted by Taha Hafeez <ta...@gmail.com>.
Thanks, you are right it will prevent any effect on the browser back
button...

regards
taha

On Thu, Apr 7, 2011 at 12:52 PM, Sigbjørn Tvedt <si...@gmail.com> wrote:

> Hi Taha.
>
> Thank you for sharing the code.
>
> If I could suggest a improvement, I would recommend adding onClick="return
> false;" to the generated link.
> Just change the line
>       writer.element("a", "href", "#", "id", getClientId());
> to
>      writer.element("a", "href", "#", "id", getClientId(), "onClick",
> "return false;");
>
> This will stop the browser from following the link after you have clicked
> it.
>
> Regards
> Sigbjørn Tvedt
>
>
> On Fri, Mar 25, 2011 at 17:20, Taha Hafeez <ta...@gmail.com>
> wrote:
>
> > also, you need to add
> >
> > this.event("onContentLoaded");
> >
> > at the end of the loadContent method of Modalbox
> >
> > I am trying a few tricks, so that modalbox.js is not modified...
> >
> > taha
> >
> >
> > On Fri, Mar 25, 2011 at 8:49 PM, Taha Hafeez <tawus.tapestry@gmail.com
> > >wrote:
> >
> > > Hi Jim,
> > >
> > > This is the modified javascript to include zone updates
> > >
> > > ModalBoxInit = Class.create( {
> > >
> > >    /* Initialize Function */
> > >    initialize : function(spec) {
> > >       var options = spec.params;
> > >       if (spec.type == "page") {
> > >          Event.observe($(spec.id), spec.event, function() {
> > >             Modalbox.show(spec.href, options);
> > >          });
> > >       } else {
> > >          Event.observe($(spec.id), spec.event, function() {
> > >             var successHandler = function(transport) {
> > >                var node = new Element('div')
> > >                      .update(transport.responseJSON.content);
> > >                options.onContentLoaded = function() {
> > >                   Tapestry.loadScriptsInReply(transport.responseJSON,
> > > function() {
> > >                   });
> > >                };
> > >                Modalbox.show(node, options);
> > >             }.bind(this);
> > >
> > >             Tapestry.ajaxRequest(spec.href, {
> > >                method : 'get',
> > >                onSuccess : successHandler
> > >             });
> > >          }.bind(this));/* Event.observe */
> > >       }
> > >    }
> > > });
> > >
> > > regards
> > > Taha
> > >
> > >
> > > On Fri, Mar 25, 2011 at 5:03 PM, Jim O'Callaghan <
> jc1000001@yahoo.co.uk
> > >wrote:
> > >
> > >> This looks very handy Taha thanks for sharing - I'm thinking of trying
> > it
> > >> in
> > >> a page and was wondering if you had gotten around to posting the
> support
> > >> for
> > >> zone updates anywhere? Thanks.
> > >>
> > >> Regards,
> > >> Jim.
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > >> For additional commands, e-mail: users-help@tapestry.apache.org
> > >>
> > >>
> > >
> >
>