Ok that is quite nice. Still a few things. I'm at this point:
<initialization>
dojo.event.connectOnce(tapestry.form, "submitAsync", function
(e) {
if (e.id != "addBillableItemEventForm") return;
dojo.widget.byId("addBillableItemEventDialog").hide();
});
</initialization>
The thing is, if validation fails, which is client side, then it pops
up the validation error dialog, but closes the form dialog anyway
(immediately). I'm still digging to see what I'm supposed to do to
prevent this.
Attaching to onFormSubmit didn't appear to have any effect at all in
my case (ie the form dialog doesn't close when you submit).
Thanks,
J
On 9-May-07, at 5:19 PM, Jesse Kuhnert wrote:
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