You need to trigger the validation by using jQuery's trigger method,
eg. $("#validateThis").submit();

Calling the DOM submit method directly avoids the validation.

Jörn

On Thu, May 7, 2009 at 7:30 AM, sjoerdm <sjoerd.maes...@scarlet.be> wrote:
>
> Im having trouble to validate my form because I'm missing a submit
> button inside the form, I submit my form by another link outside the
> form.
>
>
> <a href="#" onclick="document.validateThis.submit(); return
> false;">save</a>
>
> <form id="validateThis" name="validateThis" method="POST" action="">
>     <input type="text" name="name" value=""/>
>     ...
> </form>
>
> Because I dont have a submit in my form the javascript doesnt get
> triggered I suppose, when I place a submit button in my form
> everything works just fine, btw the form also gets submitted when
> clicking on my a href.
>
> How can I fix this? The javascript is just the basic example
>
> $().ready(function() {
>                // validate the form when it is submitted
>                $("#validateThis").validate();
>
>        });
>

Reply via email to