I figured this out and I have fixed the example, so it will no longer
show the problem.
Basically, the solution is to wrap the call to ajaxForm ( including
the options parameter)  in liveQuery

$('#loginform').livequery(function(){
    var options = {
      target:     '#loginsection',
      url:        'login.php',
      success:    function() {
         alert("success!");
      }
   };
   $('#loginform').ajaxForm(options);
    return false;
  });

instead of this:
 var options = {
    target:     '#loginsection',
    url:        'login.php',
    /*
    success:    function() {
     alert("success!");
    }
    */
};
$('#loginform').ajaxForm(options);

On Dec 7, 4:34 am, rodeored <[EMAIL PROTECTED]> wrote:
> Can I use livequery on ajaxForm?
> or is there another way to add event listeners to ajax produced form?
>
> This page redirects to the examplehttp://reenie.org/test/hffc.php
>
> If you click "Login" and add any name, the form submits and shows you
> logged in.
> If you don't add a name the form submits and mimics the situation
> where the user is not found. It displays an error message and displays
> the login form again
>
> The "close" button works before and after the form is rewritten
> because it uses livequery to bind it to the click function.
> $("#loginclose") .livequery('click', function(event) {
> //closes login box}
>
> However, after the form is submitted, the form's event listeners are
> missing.and the form is will not be submitted via ajax again.
>
> I'm using this code to bind the form to the options function.
> $('#loginform').ajaxForm(options);
>
> How do I bind the form again without reloading the page?

Reply via email to