Just use Live Query to bind the submit handler. It will only bind it once
per a new form element.

$('form.client').livequery('submit', function() { alert('boo'); return
false; });

Also, try to give the selector more scope, like a parent element with an ID.

$('#containerID form.client').livequery(...);

Could you upload an example somewhere that we could see?

--
Brandon Aaron

On 8/28/07, Theodore Ni <[EMAIL PROTECTED]> wrote:
>
>
> That sounds like it should work, but it isn't doing anything. I think
> there must be something wrong with my fundamental understanding of how
> jQuery or the plugins work.
>
> Suppose I try this:
>
> $('form.client').livequery(function() {
>         //alert('new: ' + $(this).parent().attr('id'));
>         $(this).unbind('submit');
>         $(this).submit(function() { alert('boo'); return false; });
>     }, function() { alert('removed'); });
>
> After dragging, I get no alerts on form submission, and the return
> false is not working either. Oddly, if I comment out the unbind()
> statement, then the functions layer on top of one another, so I get
> progressively more and more alerts after every drag operation.
>
> I was able to directly work with the form's onsubmit, which doesn't
> layer, so this isn't a problem, but I am using the AJAX form plugin as
> well, and that doesn't work very well.
>
> It is worth nothing that the new and remove alerts show up once at the
> beginning of a drag and at the end of one, as you would expect.
>
> Unfortunately, I just don't know enough about either plugin to figure
> out what is going wrong, and I'm not very familiar with Firebug :-(
>
> I'm grateful for any help you guys can give me.
>
> On 8/28/07, Brandon Aaron <[EMAIL PROTECTED]> wrote:
> > I'm not very familiar with the Interface library but it looks like the
> > Draggable code clones the element using native DOM methods. Try
> registering
> > the Draggable plugin via the registerPlugin method (
> > http://brandonaaron.net/docs/livequery/#plugin-developers) like this:
> >
> > $.livequery.registerPlugin("Draggable");
> >
> > Now Live Query will know to watch for changes created by the Draggable
> code.
> >
> > --
> > Brandon Aaron
> >
> > On 8/28/07, Theodore Ni <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > > Hey guys,
> > >
> > > I'm having a spot of trouble combining live query with interface
> > > draggables, and I'm afraid I don't have the time to study the
> > > internals of both plugins (I'm in midst of trying to meet a deadline),
> > > so I hope you guys can briefly explain how both work.
> > >
> > > When I am dragging something, does it move the original element or
> > > does it clone it and then move it? For Live Query, how does it
> > > determine when something new is added to the DOM?
> > >
> > > I ask because I have been having trouble using live query with forms
> > > in draggable DHTML windows. I attach functions to the forms on submit
> > > using live query (because I put the name of the callback function in a
> > > hidden field inside the form), and the forms don't always work after
> > > they are dragged.
> > >
> > > Thanks,
> > > Ted
> > >
> > >
> >
>
>
> --
> Ted
>

Reply via email to