Thank you so much for the answer - and sorry for not picking up on it
sooner! (I expected to get anemail notifcation!)

I've had a go at implementing this new method but it's not working for
me. I've added your code into my validate call but it's not doing
anything there.

santiagorestaurant.es/contact.php

Thanks again for your help.

Gabriel



On Oct 21, 3:03 pm, livefree75 <jpittm...@gmail.com> wrote:
> You need to create a new plugin method:
>
> $(function()  {
>    $.validator.addMethod("no_urls",
>       function(value, element)  {
>          var re = new RegExp("([a-z\d\\-]+\\.)+[a-z]+)", "i");   // or
> whatever RegExp you want
>          var url_found = re.test(value);
>          return this.optional(element) || (!url_found);
>       },
>       "URLs are not allowed."
>    );
>
> });
>
> Then, in your validate() call, do the following:
>
>    // $f is the form
>    $f.validate({
>       rules : {
>          comment : {
>             required : true,
>             no_urls  : true
>          }
>       }
>    });
>
> On Oct 21, 3:14 am,gdekadt<gdek...@gmail.com> wrote:
>
>
>
> > [bump] Anybody out there with any clues or suggestions?
>
> > On Oct 15, 11:05 am,gdekadt<gdek...@gmail.com> wrote:
>
> > > Hi all sorry - I can't figure this out and I'm a little thick.
>
> > > I'm using the great validation plug-in from bassistance and would like
> > > to use it to stop a form submitting contents of a *required* comment
> > > field when a URL is present in there. [Getting spam links submitted to
> > > a contact from]
>
> > > I've previously managed to hack the plugin to allow spaces and a
> > > leading "+" for phone numbers but this is beyond me as I'm not trying
> > > to extend but rather invert the function. ?
>
> > > I've been trying for two hours and can neither find anything out there
> > > - or hack anything that works.

Reply via email to