Yes:

dojo.event.connectOnce(tapestry.form, "onFormSubmit" /** or even
"submitAsync" */, function(e){
    // if you think it might be an issue you can double check the target
element id
    if (evt.target.getAttribute("id") != "myExpectedId")
         return;

    dojo.widget.byId("yourDialogComponentId").hide();

   //....or if you ~really~ want it gone
   dojo.widget.byId("yourDialogComponentId").destroy();
});

That's it more or less .....All of the event connections / reconnections /
etc can be seen if you take a look at the "registerForm" function in here,
it's the core function always called by tapestry whether the form is async
or normal.

http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?view=markup

On 5/9/07, Julian Wood <[EMAIL PROTECTED]> wrote:

I'm experimenting with using a dojo Dialog for form input.

I open up a dojo dialog, add some data to my fields, and then click
on submit. Submit is just a regular old submit which submits my form
component. My form component is asynchronous and updates some parts
of the web page after its listener has finished. So far so good.

I also need it to close the dialog, and scrub the fields. How can I
invoke some javascript to do this, once the asynchronous submit has
returned successfully?

My current approach is to update a script component, which checks a
flag (set by the form listener) to see if we just had an asynchronous
form submission, and if true, includes a .script which takes the
desired javascript actions.

But it seems like a lot of work (and a lot of separate pieces) just
to invoke some javascript after the form submission. Is there a
better way?

Thanks,

J
--
Julian Wood <[EMAIL PROTECTED]>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca





--
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Reply via email to