If the return false fails, it's usually something wrong with parsing
your Javascript that causes the problem.
For example:
$("input#email).after("works");

It's missing a closing quote (") after "email".

On Jul 27, 12:28 pm, pedalpete <p...@hearwhere.com> wrote:
> Thanks John,
>
> I wasn't familiar with the .live() before, but of course I'll use that
> where I can.
>
> Though I'm honoured and humbled by your response, unfortunately, in
> this case, I'm using a 'submit', and the documentation says i can't
> use .live on submit currently. (I did try and, and it didn't work).
>
> .bind doesn't seem as efficient, as I'll be regularly binding/
> unbinding, but I've added that anyway, and still after the alerts, the
> form submits.
> As the form itself is created on the fly, i've put the bind inside the
> function which creates the form, and unbind before the form is first
> created so that i'm not stuck with the old data.
>
> Unfortunately,  i'm still stuck with the original problem, return
> false; appears to be ignored.
>
> On Jul 27, 2:14 pm, John Resig <jere...@gmail.com> wrote:
>
> > It looks like you're using the old liveQuery plugin. Why not just use
> > .bind() or .live()?
>
> > --John
>
> > On Mon, Jul 27, 2009 at 5:11 PM, pedalpete <p...@hearwhere.com> wrote:
>
> > > So, this isn't related to any one bit of code, but it seems to be a
> > > problem I run into almost everytime i need to stop a form or link for
> > > doing what it was originally intended to do (submit).
>
> > > Now, i have used return false; many times, but it never works at
> > > first.
> > > I'm never sure what I end up changing, but something changes, and then
> > > all of a sudden it works, and I am once again left stumped as to what
> > > I did.
>
> > > Yesterday, i renamed a class, and all of a sudden, it worked. Changed
> > > the class back, and guess what! It still works, though it hadn't
> > > before ...ggggrrrrr
>
> > > Today, i'm trying to use a submit, check the e-mail address and then
> > > submit the form via ajax.
> > > Once again, i can't seem to stop the form from submitting.
>
> > > There are no other javascript errors coming up in firefox.
> > > my alerts work, so i'm in the right function, but then...the form
> > > submits.
>
> > > <code>
> > >      jQuery('div#selected form#getEmail').livequery('submit', function
> > > (){
> > >        var sid=jQuery('input.emailsButton', this).attr('id');
> > >        var emailAddress=jQuery('input#email', this).val();
> > >        alert(sid);
> > >        if(isValidEmailAddress(emailAddress)) {
> > >        alert('works');
> > >                $("input#email).after("works");
> > >        } else {
> > >                alert('errored');
> > >                $("input#email, this").after("<label class='error'>Email is
> > > not
> > > valid!</label>");
>
> > >        }
> > >        return false;
> > >      });
> > > </code>
>
> > > I've tried moving the return false; into the if/else, but no changes.
>
> > > As mentioned, i think the biggest problem isn't just with this code.
> > > There is something I seem to be doing consistently.
>
> > > Thanks
>
>

Reply via email to