Hi guys, if there is a better way to do it, I'm all ears. I wasn't aware of
a way to use zones inside of a js module. Here is a code snippet of what
I'm trying to accomplish. As you can see I'm using pure js, "may be
alternate solutions", and I'm trying to inject content into my bootstrap
modal component via ajax. This would be accomplish once the dialog box has
been opened and the user clicks the dialog submit action. This wouldn't
submit the form but rather perform an ajax request returning content.
Another thought that comes to mind is to maybe write the html in tapestry
rather than js so that I can take advantage of tapestries zone's. Either
way with js becoming so popular, I'd like to understand the cores of ajax
request with tapestry so that I always have that option at my disposal.

define(["jquery", "bootstrap/modal"], function($) {

    var runDialog;

    runDialog = function(spec) {

          var $dialog = $("<div class=\"modal fade\" role=\"dialog\">\n\
                  <div class=\"modal-dialog\">\n\
                    <div class=\"modal-content\">\n\
                      <div class=\"modal-header\">\n\
                        <a class=\"close\"
data-dismiss=\"modal\">&times;</a>\n\
                        <h3>Review Warning</h3>\n\
                      </div>\n\
                      <div class=\"modal-body\"></div>\n\
                      <div class=\"modal-footer\">\n\
                      </div>\n\
                    </div>\n\
                  </div>\n\
                </div>")
                .appendTo($("body"));

                $(".modal-footer").append("<button class=\"btn
btn-warning\">Continue</button>\n\
                    <button class=\"btn btn-default\"
data-dismiss=\"modal\">Cancel</button>");

                $dialog.on("click", ".modal-footer button:first",
function() {
                            //ajax request to tapestry requesting
modal-body content.
                });

                $dialog.modal();
    };

    return runDialog;
});

Like always, thanks guys.


On Tue, Mar 11, 2014 at 4:12 AM, Geoff Callender <
geoff.callender.jumpst...@gmail.com> wrote:

> I share Lance's preference for generating markup server-side. Have you
> considered putting a Zone in the modal and having the server-side return
> that instead of a JSONObject?
>
>
> On 11/03/2014, at 7:24 AM, Lance Java wrote:
>
> > I'm not entirely sure what you're doing but this might help.
> >
> > http://tapestry-stitch.uklance.cloudbees.net/capturedemo
> >
> > As you can see, I render a block in an AJAX action and call alert(...).
> You
> > could do anything you like with the rendered markup.
> >
> > Note: I hate rendering dom in javascript and always prefer rendering my
> > markup serverside. I'm bucking the trend a bit here.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
George Christman
www.CarDaddy.com
P.O. Box 735
Johnstown, New York

Reply via email to