continue speaking with myself only

http://blogs.vertigosoftware.com/snyholm/archive/2006/09/27/3788.aspx
Current browsers do not adhere to this part of the html
specification.  The event only fires when it is activated by a user -
and does not fire when activated by code.

On Jan 22, 8:50 am, ifrond <ifr...@gmail.com> wrote:
> This works:
>
> form.get(0).onsubmit = function() {
>        if ($("input:first").val() == "correct") {
>          $("span").text("Validated...").show();
>          return true;
>        }
>        $("span").text("Not valid!").show().fadeOut(1000);
>        return false;
>   }
>
> and somewhere in the action :
>
> var form = document.getElementById('smth_id');
> if (form.onsubmit()) form.submit();
>
> WTF? Why core js submit() doesn't fire onsubmit action? When you
> submit form throw interface it fires.
>
> On Jan 21, 9:01 pm, ifrond <ifr...@gmail.com> wrote:
>
> > Example from documentation
>
> > $("form").submit(function() {
> >       if ($("input:first").val() == "correct") {
> >         $("span").text("Validated...").show();
> >         return true;
> >       }
> >       $("span").text("Not valid!").show().fadeOut(1000);
> >       return false;
> >     });
>
> > html:
> > <p>Type 'correct' to validate.</p>
> >   <form action="javascript:alert('success!');" id="smth_id">
> >     <div>
> >       <input type="text" />
> >       <input type="submit" />
> >     </div>
> >   </form>
> >   <span></span>
>
> > BUT! When you get form throw document.getElementById and submit it by
> > javascript:
> > var form = document.getElementById('smth_id');
> > form.submit();
> > jquery event handler doesn't work
>
> > How to attach event to form by jquery correctly?
>
> > I need it for tinyMCE integration, I think it will be usefull for 3d
> > party libs integration anyway

Reply via email to