Thanks Jörn, you've saved me again. Much appreciated.

This is all working now, the only issue I have left is how could I use
the Validation plugin with multiple forms? They would need different
ID's, which I can grab with a variable, but I can't seem to submit to
a specific form ID. Here is the line of code to validate:

$("form").validate();

I would like to change form to a variable, within a function. Here is
my complete code, can anyone tell me how to specify the variable
"formID" in the validate() call? Thanks for any help.

                $(document).ready(function(){                   
                        $(":submit[id$='_replace']").each(function() {
                                var submitID = $(this).attr("id");
                                var submitValue = $(this).attr("value");
                                var formID = $(this).parents("form").attr("id");
                                $(this).replaceWith( [ '<a class="replace '
                                                , submitID
                                                , '" id="'
                                                , submitID
                                                , '" href="#"><em></em>'
                                                , submitValue
                                                , '</a>'
                                                ].join('')
                                        );
                                $('#'+submitID).click(function() {
                                        $('#'+formID).submit();
                                        return false;
                                        });
                                });                                             
        
                                $("form").validate();
                        });

Cheers
Paul


On 01/04/2008, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:
>
>  Paul Collins schrieb:
>
>
> > Hi all,
> >
> > I am trying to use an anchor link to submit my form using the
> > Validator plugin, (so I can change the button to a graphic). I would
> > like to know what to put into the HREF to submit to the Validator
> > code.
> >
> > Currently I have:
> >
> > href="javascript:$(this).validate();"
> >
> > This doesn't seem to work correctly, here is my full block of code in
> > case you would like to check. I would greatly appreciate any help or
> > links.
> >
> > $(document).ready(function(){
> >       $(":submit[id$='_replace']").each(function() {
> >               var submitID = $(this).attr("id");
> >               var submitValue = $(this).attr("value");
> >               $(this).replaceWith( [ '<a class="replace '
> >                               , submitID
> >                               , '" id="'
> >                               , submitID
> >                               , '"
> > href="javascript:$(this).validate();"><em></em>'
> >                               , submitValue
> >                               , '</a>'
> >                               ].join('') );
> >               });
> >  return false;
> > });
> >
> > Thanks again
> >
> >
> >
>  Try this:
>
>  <a href="#" id="clicksubmit">Submit</a>
>
>  $(function() {
>   $("#clicksubmit").click(function() {
>    $("form").submit();
>    return false;
>   });
>  });
>
>
>  There is no need to put javascript inside hrefs when using jQuery.
>
>  Jörn
>

Reply via email to