Ken,
You can call ajaxSubmit from the anchor's click handler, but in general this is not a good way to submit forms because it won't work when JavaScript is disabled. It makes more sense to use a button element and then style it using CSS so that it looks like a text link if that's what your UI requires. Also, if what you have is a page with a form per comment, one way to refactor that would be to have only a single form. Then in your loop you would add a submit button for each comment and give that button a unique value (commentid). For example: <form action="delete_comment.php" method="post" id="comments"> <?php // loop over comments ?> <button type="submit" name="deletecomment" value="<?=$comment['commentid']?>">Delete this comment?</button> <?php // end loop ?> Only the submit button that is clicked will be submitted with the form so on the server you have easy access to the comment to be deleted: $delComment = $_POST['deletecomment']; And this would work well with ajaxForm. But this is just off the top of my head so it may not fit well with how your page is structured. Food for thought I guess. Cheers. Mike On 6/8/07, Ken Iovino <[EMAIL PROTECTED]> wrote:
I'm wondering if it's possible to use a text link to submit a form that has a unique id? I'm using the Official form plug in (http:// www.malsup.com/jquery/form/) which is great, aside from me not being able to figure this out. (= Here is the code I'm using <php start loop> <script type="text/javascript"> <!-- $(document).ready(function() { $('#deleteForm<?=$comment['commentid']?>').ajaxForm({ target: '#editor-response', success: function() { $("#deletemsg<?=$comment['commentid']? >").not(".alert").append(msg) } }); }); --> </script> <form action="ajax/delete_comment.php" method="post" id="deleteForm<?= $comment['commentid']?>"> <input type="hidden" name="do" name="deletecomment"> <a id="#deleteComment<?=$comment['commentid']?>" class="deletlink" title="Delete this comment?" href="javascript:;">delete?</a> </form> </php end loop> I was using this as the link <a href="javascript:delete_comment(document.deleteForm<?= $comment['commentid']?>)"> but it wasn't allowing the form plug-in to recognize it. Also, I'm wondering if there a more efficient way to do this. Currently the JavaScript is inside a php loop and each comment has it's own unique id. Thanks!