Just in case anyone wants to see, this is the test script that I used. Just change the filenames to whatever you want:
<html> <head> <title>Testing Dragging</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="jquery.livequery.js"></script> <script type="text/javascript" src="jquery.interface.js"></script> <script type="text/javascript"> $(document).ready(function() { // I'd think that this would work $('form.client').livequery('submit', function() { alert($(this).find('[EMAIL PROTECTED]').attr('value')); return false; }); // until I make this draggable $('#modal').Draggable(); }); </script> </head> <body style="background: blue;"> <div id="modal" style="background: green;"> <form class="client"> <div class="header">Drag me!</div><br> <input name="val" type="text" value="My Value"> <input type="submit" value="What is my value?"> </form> </div> </body> </html> On 8/28/07, Theodore Ni <[EMAIL PROTECTED]> wrote: > > I know exactly what you mean, and it makes perfect sense, and now going > back to Firefox, it works like a charm. Normally that would be enough for > me, but this needs to run in the exploder :-( > > Ok, I've gone back and tried to recreate this example, and you are right, > the selector works if I add in an id, such as > > $('#containerID form.client').livequery(...); > > Why is that? I had hoped to be able to use just $('form.client') [or $(' > form.ajax') for some other forms] because it requires some extra work to > get the id of the containing element. I have a custom Window class > which creates new IDs automatically as new windows are made, so it isn't set > in stone. > > And it seems Draggable doesn't even need to be registered as a plugin > since it probably deletes whatever cloned node it made after the drag is > over. > > Thanks for the great help. At least I now know what the problem seems to > be. > > Ted > > > On 8/28/07, Brandon Aaron <[EMAIL PROTECTED] > wrote: > > > > 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 > > > > > > > > > > -- > Ted -- Ted