[jQuery] Re: Validate jquery plugin problem

2010-01-20 Thread Niagara
No error bat if i insert a valid captcha, show label error with '1'.
If i insert a fake captcha, show label error correctly.
The part of code is:
  antispam_captcha: {
required: true,
remote: /metwit/comuni/action.php
},
Thanks.


On 19 Gen, 22:49, Nathan Klatt n8kl...@gmail.com wrote:
 2010/1/19 Niagara keit...@libero.it:

  My code with  jQuery validation plug-in 1.5 work correctly, but with
  the new version NO.

 In what way does it not work? False positives? False negatives?
 Console errors or silent refusal? Help us to help you. ;)

 Nathan


[jQuery] Re: validate - error messages keep piling up

2009-12-18 Thread Mark Livingstone
Works now :) Had to create a special class that combined all three
classes.

On Dec 17, 5:36 pm, Mark Livingstone namematters...@msn.com wrote:
 OK, thanks. I will try and report back.

 On Dec 16, 12:22 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  You have three classes specified for the errorClass. The plugin can't handle
  that. If you actually need more then one class, use the highlight and
  unhighlight options to add and remove those.

  Jörn

  On Wed, Dec 16, 2009 at 4:43 PM, Mark Livingstone 
  namematters...@msn.comwrote:

   On Dec 16, 9:59 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:

At least post your full JS codes instead of just excerpts.

Jörn

  http://jsbin.com/isuco/edit

   I can e-mail you the link to my working page if that will help.
   Unfortunately I cannot share it here.


[jQuery] Re: (validate)

2009-12-17 Thread eimantas
Here how it looks now:

validator : $('#new_place').validate({
  errorElement: 'p',
  errorPlacement: function(error, elem) {
error.addClass('error-message left');
if (elem.attr('id') != 'select_id') {
  elem.parent('span').after(error);
} else {
  elem.parents('div.line.categories').append(error);
};
  },
  meta: 'validate',
  debug: true,
  onsubmit: false,
  highlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
  $(element).parents('div.field-wrapper').addClass('errors');
  if ($(element).parent('span').next().length  0) {
$(element).parent('span').next('p.error').addClass('error-
message left');
  };
} else {
  $(element).parents('div.line.categories').prev
('div.line').addClass('errors'); // red label
  $(element).parents('div.line.categories').addClass
('errors'); // red error
};
  },
  unhighlight: function(element, errorClass) {
if ($(element).attr('id') != 'select_id') {
  $(element).parents('div.field-wrapper').removeClass
('errors');
} else {
  $(element).parents('div.line').removeClass('errors');
  $(element).parents('div.line').prev
('div.line.errors').removeClass('errors');
};
  }
}),

and as soon as i add errorClass: 'error-message left' to the validator
configuration - messages start piling up.

On Dec 16, 6:29 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Without seeing any of your code is pure guesswork to help you find the
 issue. I need to see at least the code configuring the validation plugin.

 Jörn

 2009/12/16 eimantas enc.c...@gmail.com

  Hi guys

  I'm having trouble with validation plugin from bassistance.de. I have
  custom handlers for errorPlacement, highlight and unhighlight events.
  I also have defined custom errorElement. Error messages and validation
  data is extracted via metadata plugin using html5 data-* attributes.

  The problem is that if I define custom errorClass (which i need for
  error message elements), the error gets added each time the field is
  unfocused and left blank after first validation. For example:

  1) I open form and try to submit it;
  2) Errors are displayed;
  3) I focus/blur errored field;
  4) the error for that field is added again;

  Any help would be appreciated without disclosing lots of mine code .)

  Thank you in advance for taking time to answer my call for help!


[jQuery] Re: validate - error messages keep piling up

2009-12-17 Thread Mark Livingstone
OK, thanks. I will try and report back.

On Dec 16, 12:22 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 You have three classes specified for the errorClass. The plugin can't handle
 that. If you actually need more then one class, use the highlight and
 unhighlight options to add and remove those.

 Jörn

 On Wed, Dec 16, 2009 at 4:43 PM, Mark Livingstone 
 namematters...@msn.comwrote:

  On Dec 16, 9:59 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   At least post your full JS codes instead of just excerpts.

   Jörn

 http://jsbin.com/isuco/edit

  I can e-mail you the link to my working page if that will help.
  Unfortunately I cannot share it here.


[jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Mark Livingstone
anyone? :)

On Dec 15, 12:37 pm, Mark Livingstone namematters...@msn.com wrote:
 Hi,

 Since I moved to a new design I cannot figure out how to stop the
 validate plug-in to append error messages and instead have it remove
 the previous error message before creating another one.

 here is what my HTML code looks like with multiple error messages:

 p
 label for=email
 E-mail
 /label
   input class=text-input medium-input input-notification error
 png_bg name=client[email] id=email value={EMAIL} size=25
 span class=errorValidate generated=true htmlfor=email
 This field is mandatory
 /span
 span class=errorValidate generated=true htmlfor=email
 This field is mandatory
 /span
 span class=errorValidate generated=true htmlfor=email
 This field is mandatory
 /span
 span class=errorValidate generated=true htmlfor=email
 This field is mandatory
 /span
 span class=errorValidate generated=true htmlfor=email
 Please enter a valid e-mail address
 /span
 /p

 CSS:

 .errorValidate {
                                 padding: 2px 0 2px 22px;
                                 margin: 0 0 0 5px;
                                 }

 JS:

 var validateForm = $(#clientUpdateForm).validate(
 {
    errorClass: errorValidate,
    /etc/...

 }

 Any ideas why it would do that?

 Thanks in advance!


Re: [jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Jörn Zaefferer
Could you provide a full example, eg. via jsbin.com?

Jörn

On Wed, Dec 16, 2009 at 2:53 PM, Mark Livingstone namematters...@msn.comwrote:

 anyone? :)

 On Dec 15, 12:37 pm, Mark Livingstone namematters...@msn.com wrote:
  Hi,
 
  Since I moved to a new design I cannot figure out how to stop the
  validate plug-in to append error messages and instead have it remove
  the previous error message before creating another one.
 
  here is what my HTML code looks like with multiple error messages:
 
  p
  label for=email
  E-mail
  /label
input class=text-input medium-input input-notification error
  png_bg name=client[email] id=email value={EMAIL} size=25
  span class=errorValidate generated=true htmlfor=email
  This field is mandatory
  /span
  span class=errorValidate generated=true htmlfor=email
  This field is mandatory
  /span
  span class=errorValidate generated=true htmlfor=email
  This field is mandatory
  /span
  span class=errorValidate generated=true htmlfor=email
  This field is mandatory
  /span
  span class=errorValidate generated=true htmlfor=email
  Please enter a valid e-mail address
  /span
  /p
 
  CSS:
 
  .errorValidate {
  padding: 2px 0 2px 22px;
  margin: 0 0 0 5px;
  }
 
  JS:
 
  var validateForm = $(#clientUpdateForm).validate(
  {
 errorClass: errorValidate,
 /etc/...
 
  }
 
  Any ideas why it would do that?
 
  Thanks in advance!



[jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Mark Livingstone
Jörn , it's hard to extract the code and make it functional just for
jsbin.com

Basically, the validation plug-in APPENDS span element that contains
the error message right after the input field. When another message
appears, it appends it again instead of first removing the initial
message.

My workaround is ugly but does the job:

onkeyup: function(element)
{
$(element).next().remove();
},
focusInvalid: false,
invalidHandler: function()
{
$(span).each(function(){ if($(this).attr(class) == input-
notification error png_bg) { $(this).remove(); } });
},
onfocusout: function(element)
{
$(element).next().remove();
$(span).each(function(){ if($(this).next().attr(class) == 
input-
notification error png_bg) { $(this).next().remove(); } });
},

This basically shows error messages only when the form is submitted.
When the input field is in focus, it removes the error message. The
onfocusout option removes repeated messages.

I just can't figure out why it would behave this way.

On Dec 16, 8:58 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Could you provide a full example, eg. via jsbin.com?

 Jörn

 On Wed, Dec 16, 2009 at 2:53 PM, Mark Livingstone 
 namematters...@msn.comwrote:

  anyone? :)

  On Dec 15, 12:37 pm, Mark Livingstone namematters...@msn.com wrote:
   Hi,

   Since I moved to a new design I cannot figure out how to stop the
   validate plug-in to append error messages and instead have it remove
   the previous error message before creating another one.

   here is what my HTML code looks like with multiple error messages:

   p
   label for=email
   E-mail
   /label
     input class=text-input medium-input input-notification error
   png_bg name=client[email] id=email value={EMAIL} size=25
   span class=errorValidate generated=true htmlfor=email
   This field is mandatory
   /span
   span class=errorValidate generated=true htmlfor=email
   This field is mandatory
   /span
   span class=errorValidate generated=true htmlfor=email
   This field is mandatory
   /span
   span class=errorValidate generated=true htmlfor=email
   This field is mandatory
   /span
   span class=errorValidate generated=true htmlfor=email
   Please enter a valid e-mail address
   /span
   /p

   CSS:

   .errorValidate {
                                   padding: 2px 0 2px 22px;
                                   margin: 0 0 0 5px;
                                   }

   JS:

   var validateForm = $(#clientUpdateForm).validate(
   {
      errorClass: errorValidate,
      /etc/...

   }

   Any ideas why it would do that?

   Thanks in advance!


Re: [jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Jörn Zaefferer
At least post your full JS codes instead of just excerpts.

Jörn

On Wed, Dec 16, 2009 at 3:54 PM, Mark Livingstone namematters...@msn.comwrote:

 Jörn , it's hard to extract the code and make it functional just for
 jsbin.com

 Basically, the validation plug-in APPENDS span element that contains
 the error message right after the input field. When another message
 appears, it appends it again instead of first removing the initial
 message.

 My workaround is ugly but does the job:

onkeyup: function(element)
{
$(element).next().remove();
},
focusInvalid: false,
invalidHandler: function()
{
$(span).each(function(){ if($(this).attr(class) ==
 input-
 notification error png_bg) { $(this).remove(); } });
},
onfocusout: function(element)
{
$(element).next().remove();
$(span).each(function(){ if($(this).next().attr(class)
 == input-
 notification error png_bg) { $(this).next().remove(); } });
},

 This basically shows error messages only when the form is submitted.
 When the input field is in focus, it removes the error message. The
 onfocusout option removes repeated messages.

 I just can't figure out why it would behave this way.

 On Dec 16, 8:58 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
  Could you provide a full example, eg. via jsbin.com?
 
  Jörn
 
  On Wed, Dec 16, 2009 at 2:53 PM, Mark Livingstone 
 namematters...@msn.comwrote:
 
   anyone? :)
 
   On Dec 15, 12:37 pm, Mark Livingstone namematters...@msn.com wrote:
Hi,
 
Since I moved to a new design I cannot figure out how to stop the
validate plug-in to append error messages and instead have it remove
the previous error message before creating another one.
 
here is what my HTML code looks like with multiple error messages:
 
p
label for=email
E-mail
/label
  input class=text-input medium-input input-notification error
png_bg name=client[email] id=email value={EMAIL} size=25
span class=errorValidate generated=true htmlfor=email
This field is mandatory
/span
span class=errorValidate generated=true htmlfor=email
This field is mandatory
/span
span class=errorValidate generated=true htmlfor=email
This field is mandatory
/span
span class=errorValidate generated=true htmlfor=email
This field is mandatory
/span
span class=errorValidate generated=true htmlfor=email
Please enter a valid e-mail address
/span
/p
 
CSS:
 
.errorValidate {
padding: 2px 0 2px 22px;
margin: 0 0 0 5px;
}
 
JS:
 
var validateForm = $(#clientUpdateForm).validate(
{
   errorClass: errorValidate,
   /etc/...
 
}
 
Any ideas why it would do that?
 
Thanks in advance!



[jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Mark Livingstone
On Dec 16, 9:59 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 At least post your full JS codes instead of just excerpts.

 Jörn

http://jsbin.com/isuco/edit

I can e-mail you the link to my working page if that will help.
Unfortunately I cannot change it here.


[jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Mark Livingstone
On Dec 16, 9:59 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:

 At least post your full JS codes instead of just excerpts.

 Jörn

http://jsbin.com/isuco/edit

I can e-mail you the link to my working page if that will help.
Unfortunately I cannot share it here.


Re: [jQuery] Re: validate - error messages keep piling up

2009-12-16 Thread Jörn Zaefferer
You have three classes specified for the errorClass. The plugin can't handle
that. If you actually need more then one class, use the highlight and
unhighlight options to add and remove those.

Jörn

On Wed, Dec 16, 2009 at 4:43 PM, Mark Livingstone namematters...@msn.comwrote:

 On Dec 16, 9:59 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  At least post your full JS codes instead of just excerpts.

  Jörn

 http://jsbin.com/isuco/edit

 I can e-mail you the link to my working page if that will help.
 Unfortunately I cannot share it here.



[jQuery] Re: validate

2009-12-14 Thread sucheta
Rob,

Thanks . I will try this and get back ..

Sucheta

On Dec 12, 1:39 pm, rpinna bpi...@demandfactory.com wrote:
 I have a similar situation with a timepicker control.  I have a text
 input and an image that displays a popup when selected.
 The popup fills the input field when a selection is made.  The
 timepicker control allows me to define a callback whenever this
 occurs.

 I use the callback to force validation as follows:

 function() { $datefield.change(); $myform.validate().element('#'
 +datefieldid); });

 The $datefield, $myform, and datefieldid are all available via closure
 in my case.

 ~Rob

 On Dec 4, 3:41 am, sucheta suchet...@yahoo.com wrote: Hello all,

  I am using the 
  JQueryvalidator fromhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
  . And I am using the calandar component from YUI.

  The problem is similar to what bobbykjack has .

  I have an input field ,when user clicks into it the calendar pops up.
  When user chooses a date it fills the input box. But the error message
  which had been displayed on clicking the submit button before the
  field was filled  does not go away.

  How do I get rid off it?.

  Thanks in advance .
  Sucheta


[jQuery] Re: validate

2009-12-14 Thread caii
can't reply??!!

On Dec 14, 6:04 pm, sucheta suchet...@yahoo.com wrote:
 Rob,

 Thanks . I will try this and get back ..

 Sucheta

 On Dec 12, 1:39 pm, rpinna bpi...@demandfactory.com wrote:

  I have a similar situation with a timepicker control.  I have a text
  input and an image that displays a popup when selected.
  The popup fills the input field when a selection is made.  The
  timepicker control allows me to define a callback whenever this
  occurs.

  I use the callback to force validation as follows:

  function() { $datefield.change(); $myform.validate().element('#'
  +datefieldid); });

  The $datefield, $myform, and datefieldid are all available via closure
  in my case.

  ~Rob

  On Dec 4, 3:41 am, sucheta suchet...@yahoo.com wrote: Hello all,

   I am using the 
   JQueryvalidator fromhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
   . And I am using the calandar component from YUI.

   The problem is similar to what bobbykjack has .

   I have an input field ,when user clicks into it the calendar pops up.
   When user chooses a date it fills the input box. But the error message
   which had been displayed on clicking the submit button before the
   field was filled  does not go away.

   How do I get rid off it?.

   Thanks in advance .
   Sucheta


[jQuery] Re: validate

2009-12-12 Thread rpinna
Sucheta,

You need to trigger a change event when the popup sets the input
field.  Something like...

mydateinput.change();

~Rob

On Dec 4, 3:41 am, sucheta suchet...@yahoo.com wrote:
 Hello all,

 I am using the 
 JQueryvalidator fromhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
 . And I am using the calandar component from YUI.

 The problem is similar to what bobbykjack has .

 I have an input field ,when user clicks into it the calendar pops up.
 When user chooses a date it fills the input box. But the error message
 which had been displayed on clicking the submit button before the
 field was filled  does not go away.

 How do I get rid off it?.

 Thanks in advance .
 Sucheta


[jQuery] Re: validate

2009-12-12 Thread rpinna
I have a similar situation with a timepicker control.  I have a text
input and an image that displays a popup when selected.
The popup fills the input field when a selection is made.  The
timepicker control allows me to define a callback whenever this
occurs.

I use the callback to force validation as follows:

function() { $datefield.change(); $myform.validate().element('#'
+datefieldid); });

The $datefield, $myform, and datefieldid are all available via closure
in my case.

~Rob

On Dec 4, 3:41 am, sucheta suchet...@yahoo.com wrote:
 Hello all,

 I am using the 
 JQueryvalidator fromhttp://bassistance.de/jquery-plugins/jquery-plugin-validation/
 . And I am using the calandar component from YUI.

 The problem is similar to what bobbykjack has .

 I have an input field ,when user clicks into it the calendar pops up.
 When user chooses a date it fills the input box. But the error message
 which had been displayed on clicking the submit button before the
 field was filled  does not go away.

 How do I get rid off it?.

 Thanks in advance .
 Sucheta


[jQuery] Re: validate

2009-12-10 Thread Marcuus
Bugger it Ill go back to doing it the old fashioned way.
Ive wasted 2 days on this pluggin.
I was wondering what the b stood for in bassisstance!
M.

On Dec 10, 10:44 am, Marcuus markbe...@gmail.com wrote:
 Hi

 I am using validation plugin with a submodal dialogue form.

 It works really well except on the second time into the form the
 validate() always returns true.

 Do I need to reset the form (or something)

 Regards
 Mark


[jQuery] Re: [validate] - jquery plugin + recaptcha = anyone get this to work?

2009-12-07 Thread Scott Sauyet
On Dec 7, 10:24 am, Carlos De Oliveira cdeolive...@grupozoom.com
wrote:
 This is a JQuery Forum.

And the question is about Jörn Zaefferer's Validation plug-in,
certainly on-topic here.

Unfortunately, I haven't used either of the CAPTCHA's under question,
nor had much experience with the validation plug-in, so I have nothing
to add.

  -- Scott


[jQuery] Re: [validate]

2009-12-02 Thread 123gotoandplay
Tx for the quick answer

I am using this plugin
http://bassistance.de/jquery-plugins/jquery-plugin-validation/

I will try to put the js code on the bottom (after i have created the
dyn. fields)

Thnks for pointing me to the 'live' function but i don't think i can
use it in combo
with the validation plugin i am using at the moment

Regards

On 2 dec, 10:56, Dhruva Sagar dhruva.sa...@gmail.com wrote:
 Are you using some validate plugin ?

 If you are doing so, you need to ensure that you execute your code only
 after the dynamically generated fields have been generated OR you do it
 everytime your dynamically generated fields are being generated.

 For ordinary events, there is this 'live' function that jQuery provides
 which enables you to be able to bind events even to such dynamically
 generated nodes, but I am not sure if you can make use of that for this
 validate() call.

 Thanks  Regards,
 Dhruva Sagar.

 On Wed, Dec 2, 2009 at 3:21 PM, 123gotoandplay 
 wesweatyous...@gmail.comwrote:

  Hi,

  I am trying to validate some dynamic generated input fields, like so

  $(#form1).validate({
                 rules: {
                 $([name^=eventlink]) : {
                                 required: true,
                                 url: true
                         }
                 }

  The input fields have the word eventlink in common, unfort this
  doesn't work


[jQuery] Re: [validate]

2009-12-02 Thread 123gotoandplay
ok this one helped me out:
http://stackoverflow.com/questions/1020943/jquery-validate-with-a-dynamic-number-of-fields


[jQuery] Re: validate

2009-12-01 Thread tom
I asked the question on stack overflow:
http://stackoverflow.com/questions/1827483/jquery-validate-plugin-how-to-trim-values-before-form-validation

On Dec 1, 1:50 pm, tom thomasfothe...@googlemail.com wrote:
 I'm using the jquery.validation plugin by Jörn Zaefferer and I was
 wondering whether there's a easy way to trim form elements before they
 are validated.

 For example, if I'm validating a email address: t...@test.com   
 using the email : true rule, it'll display an error because the
 trailing whitespace is invalidating the email format. I was hoping I
 could chain jQuery.trim(value) before the validation so the
 whitespace is removed and the validation error never occurs?

 Disclaimer: The jquery.validation plugin documentation page currently
 isn't working (http://docs.jquery.com/Plugins/Validation) so I can't
 RTFM.


[jQuery] Re: Validate / Remote

2009-11-28 Thread RCLumbriga
Thnk a lot.. Work...

Thkns

On 26 nov, 14:02, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 That script will get a single GET paremter with the name of the field as the
 key and the value of the field as the value, here you'd get
 verifica_user.php?cusuario=username

 Jörn

 On Thu, Nov 26, 2009 at 1:30 PM, RCLumbriga ronanl...@gmail.com wrote:
  Hi..  Sory the really bad english

  I have one problem with remote in Jquery.validate

  I do this

   cusuario:{
                                 required: true, minlength: 5,
                                 remote: verifica_user.php
                             },

  Now  i whant know how the script verifica_user.php will recive the
  information..

  
  I still trying make one script when any user go create on account,,
  first will verify if this account exist. If exist will appear on
  message.. This accound still in use. Please choice another..

  But i don't know how get the user still typing and pass from php
  script, where will do this comparation..

  Thanks


[jQuery] Re: (validate)

2009-11-23 Thread Enoch
Thanks  for your aid.

On Nov 22, 1:40 am, Tsz Ming WONG tszm...@gmail.com wrote:
 On Sun, Nov 22, 2009 at 11:21 AM, Enoch enochelli...@gmail.com wrote:

 script type=text/javascript
 $().ready(function() {
        // validate signup form on keyup and submit
        $(#regform).validate({
                rules: {
                        fname: {
                                required: true,
                                minlength: 2
                        },
                        email: {
                                required: true,
                                email: true
                        },
                messages: {
                        fname: Please enter your firstname,
                        email: Please enter a valid email address,
                }
          }});

 });

 Because you have syntax error in your code.

 Also, extra comma after  `email: Please enter a valid email address` is
 not needed.

 --
 Best Regards,
 tszming


[jQuery] Re: (validate) error in IE7

2009-11-18 Thread dmikester1
Hey Jörn,
Do you have a fix for this?
Thanks
Mike

On Nov 17, 9:59 am, dmikester1 dmikest...@gmail.com wrote:
 I couldn't figure out how to include stuff like css and images at that
 link.

 http://www.michaelandregina.com/chris/form.html

 Thanks
 Mike

 On Nov 17, 9:43 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  Could you provide some code? A testpage? jsbin.com works great for that.

  Jörn

  On Tue, Nov 17, 2009 at 4:39 PM, dmikester1 dmikest...@gmail.com wrote:
   Here is the screenshot of the bug or error in IE7.  Can anyone help me
   figure this one out?
  http://www.michaelandregina.com/jqueryErrorInIE7.png
   Thanks
   Mike


[jQuery] Re: (validate) error in IE7

2009-11-17 Thread dmikester1
I couldn't figure out how to include stuff like css and images at that
link.

http://www.michaelandregina.com/chris/form.html

Thanks
Mike

On Nov 17, 9:43 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Could you provide some code? A testpage? jsbin.com works great for that.

 Jörn

 On Tue, Nov 17, 2009 at 4:39 PM, dmikester1 dmikest...@gmail.com wrote:
  Here is the screenshot of the bug or error in IE7.  Can anyone help me
  figure this one out?
 http://www.michaelandregina.com/jqueryErrorInIE7.png
  Thanks
  Mike


[jQuery] Re: (validate) Can rules be turned off by setting them to false?

2009-11-11 Thread Mike817
bump

On Nov 3, 11:30 pm, Mike817 mike...@gmail.com wrote:
 I'm trying to use a checkbox to turn a validation rule off or on. The
 rules I'm using is:

 MyField: {
         required: #MyCheckbox:unchecked,
         number: #MyCheckbox:unchecked

 }

 The required rule turns off fine, but the number rule stays on.  Is
 there anyway to make this work?


[jQuery] Re: (validate) Using metadata attr type with validate plugin

2009-11-10 Thread Iwan Vosloo

On Nov 10, 11:29 am, Iwan Vosloo i...@reahl.org wrote:
 (The following does work:)
 input id=cname name=name maxlength=5 minlength=2
 required=*
           class={messages:{required:'Enter this!',minlength:'Too
 short!'}}/

Oops, that should have read:
input id=cname name=name maxlength=5 minlength=2
  required=*
  class={data:{messages:{required:'Enter
this!',minlength:'Too short!'}}}/

-i


[jQuery] Re: (validate plugin) dependency callback not being triggered

2009-11-09 Thread Brad Hile
Thanks Jules I'll give it a try now.
I was looking for something that would trigger the validation but I
thought it was automagically triggered onblur/keyup but perhaps thats
only after the initially validate via submit

* thanks for the typo spotting!.. totally missed that

ta
Brad

On Nov 6, 11:14 am, Jules jwira...@gmail.com wrote:
 Hi,

 Validation only triggered if you call submit the page or call the $
 (form).valid() function. I didn't see any submit() or  $
 (form).valid() call in your page.

 Try adding this to your page

 js script inside ready()

 $(#validateMe).click(function(){
    if($(form).valid())
      alert(All data are valid);
    else
      alert(Invalid data);

 });

 html
 input type=button id=validateMe name=validateMe
 value=Validate /

 Hope this help.

 BTW: you misspelled territory in ACT :)

 On Nov 6, 12:06 pm, Brad Hile brad.h...@gmail.com wrote:

  Bump

   Hi
   I've tried every way I can think of to use dependency to enable
   additional elements to be required and have had no luck at all. I
   simply want to enable required on a number of fields when a specific
   radio button is selected and for it to be disabled when its not.
   (These fields are hidden when the radio button is deselected)
   I've tested the response from the functions and it appears correct but
   after hours of staring at this I just can't figure it out.
   Help.. please?

   original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4
   though I may have changed it by the time you look at this.

   So basically I've tried an inline function  something like:

   organisation:{required: function(element) {
           return $(.payment_type:checked).val()  == 'invoice');
         }
      }
   - - - - - - - - - - - - - -
   Setting a var to true/false when the radio button is clicked and
   testing that:

   var invoice;

   $(.payment_type).change(function () {
        if($(this).val() != 'paypal'){
                    $(#paybyinvoicefields).slideDown('slow');
                   invoice =  true;
            } else {
    $(#paybyinvoicefields).slideUp('slow');
                   invoice =  false;
            }

   organisation:{required: invoice}
   - - - - - - - - - - - - - -
   Using an enternal function

   organisation:{required: invoiceme() }

           function invoiceme() {
              return ($(.payment_type:checked).val()  == 'invoice')?
   true : false;
       }


[jQuery] Re: (validate) preclude, deny, disallow or prohibit URLs from submitting

2009-11-09 Thread gdekadt
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,gdekadtgdek...@gmail.com wrote:



  [bump] Anybody out there with any clues or suggestions?

  On Oct 15, 11:05 am,gdekadtgdek...@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.


[jQuery] Re: (validate) Customising bassistance validation plugin

2009-11-09 Thread Iwan Vosloo
Hi Jörn,

On Nov 7, 3:28 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 The plugin by default picks up attributes, so if you're using attribute
 names that match validation plugin methods, it should work like that. Though
 you may need to also provide a value, ala required=true, not sure about
 that.

This works for validation methods, but not for the required...

Regards
- Iwan


[jQuery] Re: (validate) Customising bassistance validation plugin

2009-11-09 Thread Iwan Vosloo
Ah,

I got it working... The value of the required attribute should be a
dependency-expression (http://docs.jquery.com/Plugins/Validation/
Methods/required#dependency-expression  )

So, required=true does not work.  I'm still trying to figure out
what else can be in there / what exactly a dependency-expression is,
but it seems that the following works (although I'd like to understand
still...):

required=:true
required={:true}
required={anynamehere:true}
required={:anystringhere}

-i

On Nov 9, 2:14 pm, Iwan Vosloo i...@reahl.org wrote:
 Hi Jörn,

 On Nov 7, 3:28 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  The plugin by default picks up attributes, so if you're using attribute
  names that match validation plugin methods, it should work like that. Though
  you may need to also provide a value, ala required=true, not sure about
  that.

 This works for validation methods, but not for the required...

 Regards
 - Iwan


[jQuery] Re: (validate) Customising bassistance validation plugin

2009-11-09 Thread Iwan Vosloo
Of course, its a jquery expression, what else...

However, I do think the docs may be wrong:  at
http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression

In the arguments section it reads:
An expression (String) is evaluated in the context of the element's
form, making the field required only if the expression returns more
than one element.

Surely that should be one or more elements?

Regards
- Iwan


[jQuery] Re: (validate plugin) dependency callback not being triggered

2009-11-05 Thread Brad Hile
Bump

 Hi
 I've tried every way I can think of to use dependency to enable
 additional elements to be required and have had no luck at all. I
 simply want to enable required on a number of fields when a specific
 radio button is selected and for it to be disabled when its not.
 (These fields are hidden when the radio button is deselected)
 I've tested the response from the functions and it appears correct but
 after hours of staring at this I just can't figure it out.
 Help.. please?

 original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4
 though I may have changed it by the time you look at this.

 So basically I've tried an inline function  something like:

 organisation:{required: function(element) {
         return $(.payment_type:checked).val()  == 'invoice');
       }
    }
 - - - - - - - - - - - - - -
 Setting a var to true/false when the radio button is clicked and
 testing that:

 var invoice;

 $(.payment_type).change(function () {
      if($(this).val() != 'paypal'){
                  $(#paybyinvoicefields).slideDown('slow');
                 invoice =  true;
          } else {
  $(#paybyinvoicefields).slideUp('slow');
                 invoice =  false;
          }

 organisation:{required: invoice}
 - - - - - - - - - - - - - -
 Using an enternal function

 organisation:{required: invoiceme() }

         function invoiceme() {
            return ($(.payment_type:checked).val()  == 'invoice')?
 true : false;
     }


[jQuery] Re: (validate plugin) dependency callback not being triggered

2009-11-05 Thread Jules
Hi,

Validation only triggered if you call submit the page or call the $
(form).valid() function. I didn't see any submit() or  $
(form).valid() call in your page.

Try adding this to your page

js script inside ready()

$(#validateMe).click(function(){
   if($(form).valid())
 alert(All data are valid);
   else
 alert(Invalid data);
});

html
input type=button id=validateMe name=validateMe
value=Validate /


Hope this help.

BTW: you misspelled territory in ACT :)

On Nov 6, 12:06 pm, Brad Hile brad.h...@gmail.com wrote:
 Bump

  Hi
  I've tried every way I can think of to use dependency to enable
  additional elements to be required and have had no luck at all. I
  simply want to enable required on a number of fields when a specific
  radio button is selected and for it to be disabled when its not.
  (These fields are hidden when the radio button is deselected)
  I've tested the response from the functions and it appears correct but
  after hours of staring at this I just can't figure it out.
  Help.. please?

  original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4
  though I may have changed it by the time you look at this.

  So basically I've tried an inline function  something like:

  organisation:{required: function(element) {
          return $(.payment_type:checked).val()  == 'invoice');
        }
     }
  - - - - - - - - - - - - - -
  Setting a var to true/false when the radio button is clicked and
  testing that:

  var invoice;

  $(.payment_type).change(function () {
       if($(this).val() != 'paypal'){
                   $(#paybyinvoicefields).slideDown('slow');
                  invoice =  true;
           } else {
   $(#paybyinvoicefields).slideUp('slow');
                  invoice =  false;
           }

  organisation:{required: invoice}
  - - - - - - - - - - - - - -
  Using an enternal function

  organisation:{required: invoiceme() }

          function invoiceme() {
             return ($(.payment_type:checked).val()  == 'invoice')?
  true : false;
      }


[jQuery] Re: (validate) validation (plugin) remote message option problem.

2009-11-04 Thread Nemezya
Hi,

I don't know if it can help but i had a quite similar problem.
The function associated to my remote test was triggered whatever the
server response because of a bad json encoding for the true/false
response.
I used json_encode() and it works now.





[jQuery] Re: (validate) validator is undefined error

2009-10-30 Thread Collectonian
Awesome! That worked! Thank you so much!

~~ Summer

On Oct 29, 4:38 pm, Jules jwira...@gmail.com wrote:
 Sorry, didn't read the question thoroughly,

                     whyvisitother: {
                         required: function(element) {

                             var result = false;
                             var chk = $([name=whyvisit]);

                             $([name=whyvisit]:checked).each(function
 () {
                                 if (chk.index($(this)) == 4)
                                     result = true;
                             });

                             return result;
                         }
                     }



Re: [jQuery] Re: (validate) form field validation with field id doesn't work.

2009-10-30 Thread Don Dunbar
Hi, multiple fields should not have the same 'name' in a form. If you need
first name for two parts of a form, then you should give a more explicit
name to the input : ex. first name for shipping could be 'firstNameShip' and
first name for billing could be 'firstNameBill' etc. The reason is because
you should be using labels that are assigned through the 'for' attribute to
an input, giving greater accessibility. This also makes for a more semantic
name scheme than firstName1.
DED

On Thu, Oct 29, 2009 at 5:22 PM, monika budhiraja 
monika.budhir...@gmail.com wrote:

 yeah . that's what I think would be some confusion coz it might be that
 multiple  fields that have same name but Ids would be unique throughout
 page.

 So, I was really wondering, if there is any way to setup rules and
 validations based on ids and ignore names completely.

 On Thu, Oct 29, 2009 at 5:02 PM, James james.gp@gmail.com wrote:

 If you change the name of your field, you'd have to change your rules
 in the validation options from firstname to firstname1 also.

 On Oct 29, 10:34 am, Monika monika.budhir...@gmail.com wrote:
  Hi :
I am trying to use jquery validatro plugin and used tried demo on
  the live site.  Just looking if I can use this framework for UI
  validation or not.
 So, On demo, whene i tried replacing name with id, the validation
  doesn't work.
  Demo page :  has 2 form.
   http://jquery.bassistance.de/validate/demo/
 
  And in the second form, when I change the firstname :
 
 label for=firstnameFirstname/label
 input id=firstname name=firstname /
 
  to something like :
 label for=firstnameFirstname/label
input id=firstname name=firstname1 /
 
  it doesn't work.  Please let me know if I need to do anything.





Re: [jQuery] Re: (validate) form field validation with field id doesn't work.

2009-10-30 Thread monika budhiraja
Hi there ,
  thanks for your reply.

So, you mean we need to have a label tag? Can we skip that label tag.

Also, I wanted to apply css changes based on the id.
Let;s say If we have multiple checkboxes and use multiple selections, then
we want to show some different css on selected once.

Orafter every 5 checkboxes, add some css to make some kind of distinction.

So, for that it would be easier if we have access to ids. and not the name..






On Fri, Oct 30, 2009 at 11:41 AM, Don Dunbar salemd1s...@gmail.com wrote:

 Hi, multiple fields should not have the same 'name' in a form. If you need
 first name for two parts of a form, then you should give a more explicit
 name to the input : ex. first name for shipping could be 'firstNameShip' and
 first name for billing could be 'firstNameBill' etc. The reason is because
 you should be using labels that are assigned through the 'for' attribute to
 an input, giving greater accessibility. This also makes for a more semantic
 name scheme than firstName1.
 DED


 On Thu, Oct 29, 2009 at 5:22 PM, monika budhiraja 
 monika.budhir...@gmail.com wrote:

 yeah . that's what I think would be some confusion coz it might be that
 multiple  fields that have same name but Ids would be unique throughout
 page.

 So, I was really wondering, if there is any way to setup rules and
 validations based on ids and ignore names completely.

 On Thu, Oct 29, 2009 at 5:02 PM, James james.gp@gmail.com wrote:

 If you change the name of your field, you'd have to change your rules
 in the validation options from firstname to firstname1 also.

 On Oct 29, 10:34 am, Monika monika.budhir...@gmail.com wrote:
  Hi :
I am trying to use jquery validatro plugin and used tried demo on
  the live site.  Just looking if I can use this framework for UI
  validation or not.
 So, On demo, whene i tried replacing name with id, the validation
  doesn't work.
  Demo page :  has 2 form.
   http://jquery.bassistance.de/validate/demo/
 
  And in the second form, when I change the firstname :
 
 label for=firstnameFirstname/label
 input id=firstname name=firstname /
 
  to something like :
 label for=firstnameFirstname/label
input id=firstname name=firstname1 /
 
  it doesn't work.  Please let me know if I need to do anything.






[jQuery] Re: (validate) validator is undefined error

2009-10-29 Thread Collectonian
Thanks, but that only seems to work if they only pick other. Since
they can pick multiple checkboxes from that set, I need to see if they
picked it among possibly multiple others.

On Oct 28, 5:50 pm, Jules jwira...@gmail.com wrote:
 Use this rule.
                 whyvisitother: {
                     required: function(element) {
                     return $([name=whyvisit]).index($
 ([name=whyvisit]:checked)) == 4;
                     }


[jQuery] Re: (validate) form field validation with field id doesn't work.

2009-10-29 Thread James
If you change the name of your field, you'd have to change your rules
in the validation options from firstname to firstname1 also.

On Oct 29, 10:34 am, Monika monika.budhir...@gmail.com wrote:
 Hi :
   I am trying to use jquery validatro plugin and used tried demo on
 the live site.  Just looking if I can use this framework for UI
 validation or not.
    So, On demo, whene i tried replacing name with id, the validation
 doesn't work.
 Demo page :  has 2 form.
  http://jquery.bassistance.de/validate/demo/

 And in the second form, when I change the firstname :

                        label for=firstnameFirstname/label
                        input id=firstname name=firstname /

 to something like :
    label for=firstnameFirstname/label
   input id=firstname name=firstname1 /

 it doesn't work.  Please let me know if I need to do anything.


[jQuery] Re: (validate) validator is undefined error

2009-10-29 Thread Jules
Sorry, didn't read the question thoroughly,

whyvisitother: {
required: function(element) {

var result = false;
var chk = $([name=whyvisit]);

$([name=whyvisit]:checked).each(function
() {
if (chk.index($(this)) == 4)
result = true;
});

return result;
}
}


On Oct 30, 12:14 am, Collectonian collecton...@gmail.com wrote:
 Thanks, but that only seems to work if they only pick other. Since
 they can pick multiple checkboxes from that set, I need to see if they
 picked it among possibly multiple others.

 On Oct 28, 5:50 pm, Jules jwira...@gmail.com wrote:

  Use this rule.
                  whyvisitother: {
                      required: function(element) {
                      return $([name=whyvisit]).index($
  ([name=whyvisit]:checked)) == 4;
                      }


Re: [jQuery] Re: (validate) form field validation with field id doesn't work.

2009-10-29 Thread monika budhiraja
yeah . that's what I think would be some confusion coz it might be that
multiple  fields that have same name but Ids would be unique throughout
page.

So, I was really wondering, if there is any way to setup rules and
validations based on ids and ignore names completely.

On Thu, Oct 29, 2009 at 5:02 PM, James james.gp@gmail.com wrote:

 If you change the name of your field, you'd have to change your rules
 in the validation options from firstname to firstname1 also.

 On Oct 29, 10:34 am, Monika monika.budhir...@gmail.com wrote:
  Hi :
I am trying to use jquery validatro plugin and used tried demo on
  the live site.  Just looking if I can use this framework for UI
  validation or not.
 So, On demo, whene i tried replacing name with id, the validation
  doesn't work.
  Demo page :  has 2 form.
   http://jquery.bassistance.de/validate/demo/
 
  And in the second form, when I change the firstname :
 
 label for=firstnameFirstname/label
 input id=firstname name=firstname /
 
  to something like :
 label for=firstnameFirstname/label
input id=firstname name=firstname1 /
 
  it doesn't work.  Please let me know if I need to do anything.



[jQuery] Re: (validate) validator is undefined error

2009-10-28 Thread Collectonian

Thanks...I go beat my own head now...can't believe I missed that!

On Oct 27, 9:08 pm, Jules jwira...@gmail.com wrote:
 Change

 var validator = $(#surveyForm).validate({

 to

 var validator = $(form).validate({

 or

 form action=?event=submitSurvey method=post
                         fieldset id=surveyForm
 to

 form  id=surveyForm  action=?event=submitSurvey method=post
                         fieldset

 Good luck.


[jQuery] Re: (validate) validator is undefined error

2009-10-28 Thread Collectonian
With the suggestion earlier, everything is working great, yay! All of
my validation rules are also working, as well, except I can't figure
out how to write the rule for my multi-option check box that has an
Other option so that if other is among those checked, it will
require the other input box be filled in. I have two similar ones like
that, but since they are radio buttons, I was able to just use rules
based on the demos. The rules I have and the relevant bit of the HTML
form below for easier reading. Basically, if one of the options
selected in the whyvisit set of checkboxes is the other option, the
whyvisitother input field needs to be required.

~~ SNIPPET ~~
rules: {
recommend: required,
howlearnedother: {
required: function(element) {
return $('#howlearned input[name=howlearned]:checked').val() == 
0;
}
},
describeyouother: {
required: function(element) {
return $('#describeyou input[name=describeyou]:checked').val() 
== 0;
}
}
},

~~HTML ~~
label for=whyvisitWhy did you visit the SRAC web site?/label
div id=whyvisit
input name=whyvisit type=checkbox class=checksandradios
value=1 / Aquaculture producer looking for informationbr / input
name=whyvisit type=checkbox class=checksandradios value=2 /
Educator looking for information for my classroombr /
div id=whyvisiteducator
select name=whyvisiteducator
option value=1Middle School/option
option value=2High School/option
option value=32-Year College/option
option value=44-Year College/option
/select
/div
input name=whyvisit type=checkbox class=checksandradios
value=3 / Studentbr /
div id=whyvisitstudent
select name=whyvisitstudent
option value=1Middle School/option
option value=2High School/option
option value=32-Year College/option
option value=44-Year College/option
/select
/div
input name=whyvisit type=checkbox class=checksandradios
value=4 / Individual interested in learning more about
aquaculturebr /
input name=whyvisit type=checkbox class=checksandradios
value=0 / Other input id=whyvisitother name=whyvisitother
type=text value= size=30 maxlength=30 / br /
/div


[jQuery] Re: (validate) validator is undefined error

2009-10-28 Thread Jules
Use this rule.
whyvisitother: {
required: function(element) {
return $([name=whyvisit]).index($
([name=whyvisit]:checked)) == 4;
}


On Oct 29, 7:34 am, Collectonian collecton...@gmail.com wrote:
 With the suggestion earlier, everything is working great, yay! All of
 my validation rules are also working, as well, except I can't figure
 out how to write the rule for my multi-option check box that has an
 Other option so that if other is among those checked, it will
 require the other input box be filled in. I have two similar ones like
 that, but since they are radio buttons, I was able to just use rules
 based on the demos. The rules I have and the relevant bit of the HTML
 form below for easier reading. Basically, if one of the options
 selected in the whyvisit set of checkboxes is the other option, the
 whyvisitother input field needs to be required.

 ~~ SNIPPET ~~
 rules: {
         recommend: required,
         howlearnedother: {
                 required: function(element) {
                 return $('#howlearned input[name=howlearned]:checked').val() 
 == 0;
                 }
         },
         describeyouother: {
                 required: function(element) {
                 return $('#describeyou 
 input[name=describeyou]:checked').val() == 0;
                 }
         }

 },

 ~~HTML ~~
 label for=whyvisitWhy did you visit the SRAC web site?/label
 div id=whyvisit
         input name=whyvisit type=checkbox class=checksandradios
 value=1 / Aquaculture producer looking for informationbr / input
 name=whyvisit type=checkbox class=checksandradios value=2 /
 Educator looking for information for my classroombr /
         div id=whyvisiteducator
                 select name=whyvisiteducator
                         option value=1Middle School/option
                         option value=2High School/option
                         option value=32-Year College/option
                         option value=44-Year College/option
                 /select
         /div
         input name=whyvisit type=checkbox class=checksandradios
 value=3 / Studentbr /
         div id=whyvisitstudent
                 select name=whyvisitstudent
                         option value=1Middle School/option
                         option value=2High School/option
                         option value=32-Year College/option
                         option value=44-Year College/option
                 /select
         /div
         input name=whyvisit type=checkbox class=checksandradios
 value=4 / Individual interested in learning more about
 aquaculturebr /
         input name=whyvisit type=checkbox class=checksandradios
 value=0 / Other input id=whyvisitother name=whyvisitother
 type=text value= size=30 maxlength=30 / br /
 /div


[jQuery] Re: (validate) validator is undefined error

2009-10-27 Thread Jules
Change

var validator = $(#surveyForm).validate({

to

var validator = $(form).validate({

or

form action=?event=submitSurvey method=post
fieldset id=surveyForm
to

form  id=surveyForm  action=?event=submitSurvey method=post
fieldset

Good luck.

On Oct 28, 7:54 am, Collectonian collecton...@gmail.com wrote:
 I'm trying to implement Validate on a survey form that has just a few
 basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5.
 Whenever I try to run the code, however, I get an error that
 validator is undefined. I tried Googling and found only a few hits,
 most saying the HTML was invalid. Checked that, corrected a few minor
 errors, but still getting the error. In addition to the code below, I
 tried just the basic $(#surveyForm).validate()  but it still gives
 the same error. This is on a development application, so it isn't
 available online yet.

 Summer

 SNIPPET FROM JS FILE
 var validator = $(#surveyForm).validate({
         rules: {
                 recommend: required,
                 howlearnedother: {
                         required: function(element) {
                         return $('#howlearned 
 input[name=howlearned]:checked').val() == 0;
                         }
                 },
                 describeyouother: {
                         required: function(element) {
                         return $('#describeyouother input
 [name=describeyouother]:checked').val() == 0;
                         }
                 }
         },
         messages: {
                 recommend: Please indicate if you would recommend the SRAC 
 site to
 others,
                 howlearnedother: Please indicate how you learned about SRAC's
 publications.,
                 describeyouother: Please indicate your industry.
         }

 });

 ~~~SNIPPET OF HTML FORM

                 form action=?event=submitSurvey method=post
                         fieldset id=surveyForm
                                 legendPlease complete this survey to help 
 us improve our
 offerings:/legend
                                 label for=recommendWhat is the likelihood 
 that you would
 recommend the SRAC web site or its publications to your family and
 friends? Choose one number below with 1 = not likely and 10 = highly
 likely./label
                                 div id=recommend

                                                 input name=recommend 
 type=radio value=1 / 1
                                                 input name=recommend 
 type=radio value=2 / 2
                                                 input name=recommend 
 type=radio value=3 / 3
                                                 input name=recommend 
 type=radio value=4 / 4
                                                 input name=recommend 
 type=radio value=5 / 5
                                                 input name=recommend 
 type=radio value=6 / 6
                                                 input name=recommend 
 type=radio value=7 / 7
                                                 input name=recommend 
 type=radio value=8 / 8
                                                 input name=recommend 
 type=radio value=9 / 9
                                                 input name=recommend 
 type=radio value=10 / 10
                                 /div

                                 label for=howlearnedHow did you learn 
 about SRAC publications?
 /label
                                 div id=howlearned

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=1 / Linked from another web sitebr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=2 / Search enginebr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=3 / Professional (e.g. Fisheries/aquaculture biologists)br /



                                                 input name=howlearned 
 type=radio class=checksandradios
 value=4 / Extension programbr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=5 / Friendbr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=6 / Magazinebr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=7 / Bookbr /

                                                 input name=howlearned 
 type=radio class=checksandradios
 value=0 / Other input id=howlearnedother name=howlearnedother
 value= type=text size=30 maxlength=30 /br /

                                 /div

                                 label for=whyvisitWhy did you visit the 
 SRAC web site?/label
                                 div id=whyvisit

                                                 input 

[jQuery] Re: (validate) preclude, deny, disallow or prohibit URLs from submitting

2009-10-21 Thread gdekadt

[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.


[jQuery] Re: (validate) preclude, deny, disallow or prohibit URLs from submitting

2009-10-21 Thread livefree75

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.


[jQuery] Re: (validate) equalTo with complex names

2009-10-15 Thread Jaggi

oOps thinks that wrong:

$(input[name='emailAddress.emailRepeated']).rules(add, {
equalTo: #emailAddress.email
});

i think you get the idea though.

On Oct 15, 2:07 pm, Jaggi jaggi_2...@hotmail.com wrote:
 I had this problem recently but the only way i managed to get around
 it was to do it via the custom caller. So for you you'd do:

         $(input[name='emailAddress.email']).rules(add, {
                 equalTo: #emailAddress.email
         });

 On Oct 15, 12:36 pm, ade ade.godd...@gmail.com wrote:

  HI

  Wondered if someone could help.
  I need to run a equalTo validation check on some inputs that use
  complex ids, they have fullstops in. I am trying to add the rules
  (using quotes also as specified) as per the documentation but it still
  doesnt seem to work. Code is here:

  $(document).ready(function(){

  $(#registrationDetails).validate({
    rules: {
  emailAddress.email: required email,
  emailAddress.emailRepeated: {
    equalTo: #emailAddress.email

  }
    }
  });
  });

  any help here would be great

  thanks in advance

  ade


[jQuery] Re: (validate) equalTo with complex names

2009-10-15 Thread Jaggi

I had this problem recently but the only way i managed to get around
it was to do it via the custom caller. So for you you'd do:

$(input[name='emailAddress.email']).rules(add, {
equalTo: #emailAddress.email
});

On Oct 15, 12:36 pm, ade ade.godd...@gmail.com wrote:
 HI

 Wondered if someone could help.
 I need to run a equalTo validation check on some inputs that use
 complex ids, they have fullstops in. I am trying to add the rules
 (using quotes also as specified) as per the documentation but it still
 doesnt seem to work. Code is here:

 $(document).ready(function(){

 $(#registrationDetails).validate({
   rules: {
 emailAddress.email: required email,
 emailAddress.emailRepeated: {
   equalTo: #emailAddress.email

 }
   }
 });
 });

 any help here would be great

 thanks in advance

 ade


[jQuery] Re: (validate) equalTo with complex names

2009-10-15 Thread Ade Goddard
Thanks Jaggi

Yeah that put me on the right path the below works:

 $(document).ready(function(){
 $(#registrationDetails).validate({
   rules: {
  emailAddress.email: required email,
  emailAddress.emailRepeated: {
equalTo: input[name='emailAddress.email']
  }
   }
});
});

thx again

Ade

On Thu, Oct 15, 2009 at 2:09 PM, Jaggi jaggi_2...@hotmail.com wrote:


 oOps thinks that wrong:

$(input[name='emailAddress.emailRepeated']).rules(add, {
equalTo: #emailAddress.email
});

 i think you get the idea though.

 On Oct 15, 2:07 pm, Jaggi jaggi_2...@hotmail.com wrote:
  I had this problem recently but the only way i managed to get around
  it was to do it via the custom caller. So for you you'd do:
 
  $(input[name='emailAddress.email']).rules(add, {
  equalTo: #emailAddress.email
  });
 
  On Oct 15, 12:36 pm, ade ade.godd...@gmail.com wrote:
 
   HI
 
   Wondered if someone could help.
   I need to run a equalTo validation check on some inputs that use
   complex ids, they have fullstops in. I am trying to add the rules
   (using quotes also as specified) as per the documentation but it still
   doesnt seem to work. Code is here:
 
   $(document).ready(function(){
 
   $(#registrationDetails).validate({
 rules: {
   emailAddress.email: required email,
   emailAddress.emailRepeated: {
 equalTo: #emailAddress.email
 
   }
 }
   });
   });
 
   any help here would be great
 
   thanks in advance
 
   ade



[jQuery] Re: (validate) equalTo with complex names

2009-10-15 Thread elubin

this initial example probably didn't work because of the period.
there is a documented way to use periods in jquery... in the FAQ
section How do I select an element that has weird characters in its
ID? 

http://docs.jquery.com/Frequently_Asked_Questions

eric



On Oct 15, 7:36 am, ade ade.godd...@gmail.com wrote:
 HI

 Wondered if someone could help.
 I need to run a equalTo validation check on some inputs that use
 complex ids, they have fullstops in. I am trying to add the rules
 (using quotes also as specified) as per the documentation but it still
 doesnt seem to work. Code is here:

 $(document).ready(function(){

 $(#registrationDetails).validate({
   rules: {
 emailAddress.email: required email,
 emailAddress.emailRepeated: {
   equalTo: #emailAddress.email

 }
   }
 });
 });

 any help here would be great

 thanks in advance

 ade


[jQuery] Re: (validate) equalTo with complex names

2009-10-15 Thread Ade Goddard
Yeah i was aware of that but thought that the quoting within the rules
method would overide it:) Glad its fixed now

thx

On Thu, Oct 15, 2009 at 2:33 PM, elubin elu...@yahoo.com wrote:


 this initial example probably didn't work because of the period.
 there is a documented way to use periods in jquery... in the FAQ
 section How do I select an element that has weird characters in its
 ID? 

 http://docs.jquery.com/Frequently_Asked_Questions

 eric



 On Oct 15, 7:36 am, ade ade.godd...@gmail.com wrote:
  HI
 
  Wondered if someone could help.
  I need to run a equalTo validation check on some inputs that use
  complex ids, they have fullstops in. I am trying to add the rules
  (using quotes also as specified) as per the documentation but it still
  doesnt seem to work. Code is here:
 
  $(document).ready(function(){
 
  $(#registrationDetails).validate({
rules: {
  emailAddress.email: required email,
  emailAddress.emailRepeated: {
equalTo: #emailAddress.email
 
  }
}
  });
  });
 
  any help here would be great
 
  thanks in advance
 
  ade



[jQuery] Re: Validate

2009-10-14 Thread TipTop

I have now solved this issue so no need to post any replies - Thanks!

On 8 Oct, 17:35, TipTop poppetkit...@googlemail.com wrote:
 I am new to jquery(my first application!)  and I am using the
 fantastic validate plugin. I am calling a dialog from a tab and
 although the validation  works perfectly if you keep accessing the
 dialog window after about 4 times it causes internet explorer to
 display the 'Stop running this script message as causing computer to
 run slowly' message.

 I have posted the script below and would be grateful for any help!!

 $(.manageOpportunity).click(function(e) {
                                         // alert(Manage OP);
 var oOpportunity = document.createElement(div);
 oOpportunity.setAttribute(id, OpportunityDiv);
 oOpportunity.setAttribute(title, Manage Opportunity);
 $(body).append(oOpportunity);
 $('#opportunityDetailForm').livequery(function() {
 $('input.date-picker').datePicker({startDate:'01/01/2009'});
 $(this).ajaxForm({
         beforeSubmit: function(formData, jqForm, options) {
    return $('#opportunityDetailForm').validate({
   debug: true,
   rules: {
  description: required,
 openDate: required,
 statusCodes: required,
 stageCode: required,
 decisionMakerId: required,
 repId: required,
 competitorCodes: required
   },
  messages: {
 description: Please enter an Opportunity Name,
  openDate: Please enter an Open Date,
 statusCodes: Please select a Status,
 stageCode: Please select a Stage Code,
 decisionMakerId: Please select a Descision Maker,
  repId: Please select a Sales Rep,
  competitorCodes: Please select a Competitor
     },
 errorClass: errors,
  validClass: noerrors,
  errorContainer: #formErrors,
  errorLabelContainer: #formErrors ul,
  errorElement: li,
  highlight: function(element, errorClass) {
  $(element.form).find(label[for= + element.id + ]).addClass
 (errorClass);
   },
  unhighlight: function(element, errorClass) {                                 
                  $
 (element.form).find(label[for= + element.id + ]).removeClass
 (errorClass);
    }
   }).form();
   },
  success: function() {
 $(#OpportunityDiv).dialog(destroy).remove();
 $(#tabs).tabs('load', 4);
        },
 url: companyOpportunityDetail.do?mode=manageSubmit,
        type: post});

 $('#opportunityDetailForm').expire();
    });


[jQuery] Re: (validate) How to get individual error messages and disable auto-showing

2009-10-14 Thread Mike

For my first question I ended up switching from the jalerts plugin to
just using the jquery ui dialog box.  Seems to work well.  The issue
is that the jalerts popup doesn't use a previously configured div on
the page to show things...it creates a new one...so the validation
plugin has no place to display the error messages and you can't get
access to them (yet).

The second issue is that you can set the errorContainer and
errorLabelContainer to an empty string and the errors just won't be
put anywhere...but that isn't useful unless you can get access to the
set of error messages.

On Oct 12, 3:56 pm, Mike mike.ab...@gmail.com wrote:
 I'm trying to write a custom display for the error messages on my
 form.  Ideally I'd like to use a modal pop-up window to display the
 errors, but I'm having trouble figuring out how to prevent the
 validation plugin from automatically displaying the errors on my page
 AND I can't quite figure out how to access the individual error
 messages for the elements on my form.

 What I want to do is to allow users to save invalid forms, but to warn
 them that they are invalid to make them confirm that they want to
 save.

 I have something like this:

 invalidHandler: function(form, validator) {
   //some code here figuring out if specific elements are within
 maxlength so as not to blow up the db

   if (canSave) {  //canSave determined in the comments above
    var msg = There are errors...;

    for(errors in validator.errors) {
      msg = msg + br/ + errors.message;
    }

     jConfirm(msg, 'You can still save!', function(r) {
                                                         if (r){
                                                           
 document.forms['myform'].submit();
                                                         }
                                                         else {
                                                         }
                                                 });

    if (
   }
   else {
     jAlert('Cannot save right now', 'Unable to save');
   }

 }

 Can I get access to the list of errors from the validator or even
 individually for each element in my form?

 and

 Can I turn off the auto showing of errors?

 Thanks!


[jQuery] Re: (Validate) - Specifying error placement for only one field

2009-10-13 Thread akiller

I'm fully aware this is an old post, and you've probably fixed it by
now, but I needed to do the same thing and found this via Google. This
is what I came up with:

errorPlacement: function(error, element) {
var next = element.next().attr('class');

if ( next == 'ui-datepicker-trigger' )
error.insertAfter(element.next());
else
error.insertAfter(element);
}

I imagine there's better ways mind.

On Aug 28, 11:35 pm, Erich93063 erich93...@gmail.com wrote:
 I have a form where I am using the jquery validation plugin. In that
 form, I have a date field that is using a jquerydatepickerplugin so
 a small calendar gif immediately follows the date field. The date is
 required. The problem is when the field fails validation, the error
 message appears directly after the date input pushing the calendar gif
 to the right of the error message. I know there is anerrorPlacement
 parameter that you can use, but isn't that for every field in the
 form? How can I get the error placement to go after the calendar gif
 just for the date field. Here is my test code. I am also using an AJAX
 form submission plugin. The name of my date field is startDate.
 THANKS!

 $(#myForm).validate({
                 submitHandler: function(form) {
                         $('#myForm').ajaxSubmit(function(){

                                 alert('SUCCESS');

                         });
                 }

         });


[jQuery] Re: (validate) does not work with backup php validation

2009-10-13 Thread Don Dunbar
Hi, it's hard to tell, could you explain in more detail what you mean by
'ignored completely'. Do you mean that you tried entering invalid data and
the javascript didn't produce errors? But, at the same time you seem to have
a problem in your php validation. Your if statement says 'if name exists and
if email exists and if message is not blank', not 'if name and email and
message are not blank' as you probably intended. So that could be an issue
as well.
DED

On Mon, Oct 12, 2009 at 11:07 PM, breatheonme breatheo...@gmail.com wrote:


 I'm using bassistance.de's form validation, as shown here:
 http://bassistance.de/jquery-plugins/jquery-plugin-validation/

 In the very possible event that someone is browsing without JavaScript
 enabled, I've put together a PHP form validation that should direct
 the user to an error page (or thank you page upon success).

 The JavaScript works when I do not have the validation part in the
 PHP.  When I do, it seems the JavaScript is completely ignored.

 Here's my HTML:
 form action=form.php method=post id=contactform class=form
 extended contact
  fieldset
legendContact/legend
p class=reqstrong*/strong Indicates a required field./
 p
ol
li class=name
label for=txt_nameName
 strong*/strong/label
input id=txt_name name=txt_name class=text /
/li
li class=email
label for=txt_emailEmail Address
 strong*/strong/
 label
input id=txt_email name=txt_email class=text
 /
/li
li class=message
label for=txt_messageMessage
 strong*/strong/label
textarea id=txt_message
 name=txt_message/textarea
/li
p
input type=submit name=send value=Send
 class=submit /
  /p
/ol
  /fieldset
/form


 Here's my JS:
 //initiate validator on load
$(function() {

// validate contact form on keyup and submit
$(#contactform).validate({
//set the rules for the field names
rules: {
txt_name: {
required: true,
minlength: 2
},
txt_email: {
required: true,
email: true
},
txt_message: {
required: true,
minlength: 2
},
},
//set messages to appear inline
messages: {
txt_name: Please enter your name,
txt_email: Please enter a valid email
 address,
txt_message: Please enter your message
}
});
});


 and finally, here's my PHP:
 ?php
 // get posted data into local variables
 $emailto = m...@me.com;
 $subject = Contact Form;
 $name = Trim(stripslashes($_POST['txt_name']));
 $email = Trim(stripslashes($_POST['txt_email']));
 $message = Trim(stripslashes($_POST['txt_message']));
 $today = date(F j, Y, g:i a);
 // prepare email body text
 $body = ;
 $body .= $today;
 $body .= \n;
 $body .= \n;
 $body .= Name: ;
 $body .= $name;
 $body .= \n;
 $body .= Email: ;
 $body .= $email;
 $body .= \n;
 $body .= Message: ;
 $body .= $message;
 $body .= \n;
 $body .= \n;
 // check for empty fields
 if ( $name OR $email OR $message != '' ) {
 mail($emailto, $subject, $body, From: $email, -f m...@me.com);
 print meta http-equiv=\refresh\ content=\0;URL=thankyou.php\ /
 ;
 }
 else {
 print meta http-equiv=\refresh\ content=\0;URL=error.php\ /;
 }
 ?


 Any ideas?  Thanks.



[jQuery] Re: (validate) - How do I validate required fields before form submit

2009-10-13 Thread Josh

Alex,
I am having the same issue. I have been working on this for hours, and
I might have a solution. Hopefully, somebody more knowledge about how
the Validate plugin works can speak up and help us both.

What I found is that if a field (input, select, etc) has not been
validated yet, it calls the optional method, which in turn calls the
required method to check if the field is empty. To get around this, I
override the optional method to NOT call the required method to check
the field length. I'm sure this will cause other issues, but it is a
start.

I just added the following to my page's javascript file.

jQuery.validator.prototype.optional = function(element) {
// no longer calling required to check string size
// return !$.validator.methods.required.call(this, $.trim
(element.value), element)  dependency-mismatch;
return false;
};

If you find a better solution, please let me know.
Josh

On Oct 9, 9:09 am, Alex alex.ha...@biglotteryfund.org.uk wrote:
 Hi

 I am trying to use jquery:validationplugin by Jörn Zaefferer. Which
 works really well I have to say.

 The one limitation I am trying to work around is how I can 
 runvalidationforrequiredfields before I submit a form.

 At the moment I have to submit the form before I see the error
 messages forrequiredfields I would like to see them prior as the
 user tabs through the form.

 Thanks in advance

 Alex


[jQuery] Re: (validate) - How do I validate required fields before form submit

2009-10-13 Thread Rick Faircloth

Does Jorn's plug-in still not work on blur?

Rick

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Josh
Sent: Tuesday, October 13, 2009 4:28 PM
To: jQuery (English)
Subject: [jQuery] Re: (validate) - How do I validate required fields before
form submit


Alex,
I am having the same issue. I have been working on this for hours, and
I might have a solution. Hopefully, somebody more knowledge about how
the Validate plugin works can speak up and help us both.

What I found is that if a field (input, select, etc) has not been
validated yet, it calls the optional method, which in turn calls the
required method to check if the field is empty. To get around this, I
override the optional method to NOT call the required method to check
the field length. I'm sure this will cause other issues, but it is a
start.

I just added the following to my page's javascript file.

jQuery.validator.prototype.optional = function(element) {
// no longer calling required to check string size
// return !$.validator.methods.required.call(this, $.trim
(element.value), element)  dependency-mismatch;
return false;
};

If you find a better solution, please let me know.
Josh

On Oct 9, 9:09 am, Alex alex.ha...@biglotteryfund.org.uk wrote:
 Hi

 I am trying to use jquery:validationplugin by Jörn Zaefferer. Which
 works really well I have to say.

 The one limitation I am trying to work around is how I can
runvalidationforrequiredfields before I submit a form.

 At the moment I have to submit the form before I see the error
 messages forrequiredfields I would like to see them prior as the
 user tabs through the form.

 Thanks in advance

 Alex




[jQuery] Re: (validate) - How do I validate required fields before form submit

2009-10-13 Thread Josh

The plug-in works onblur, but in the logic, it does not show a
required error if the form has not been validated OR if another error
has not been displayed. The field has to get at least one error (or
valid I think) before required will fire.

I think I have a better fix than the one I posted above.

jQuery.validator.setDefaults({
onkeyup: false, // this is my preference
onfocusout: function(element) {
// comment out all the checking and just validate the field
onblue
//if ( !this.checkable(element)  (element.name in
this.submitted || !this.optional(element)) ) {
//if ( !this.checkable(element) ) {
this.element(element);
//}
},

onclick: function(element) {
// comment out the check and just validate the field on click
// if ( element.name in this.submitted )
this.element(element);
}
});

This is now firing the validate for the fields onblur BEFORE the form
is submitted.

Please let me know if somebody has a better solution.
Josh

On Oct 13, 3:13 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 Does Jorn's plug-in still not work on blur?

 Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On

 Behalf Of Josh
 Sent: Tuesday, October 13, 2009 4:28 PM
 To: jQuery (English)
 Subject: [jQuery] Re: (validate) - How do I validaterequiredfields before
 form submit

 Alex,
 I am having the same issue. I have been working on this for hours, and
 I might have a solution. Hopefully, somebody more knowledge about how
 the Validate plugin works can speak up and help us both.

 What I found is that if a field (input, select, etc) has not been
 validated yet, it calls the optional method, which in turn calls 
 therequiredmethod to check if the field is empty. To get around this, I
 override the optional method to NOT call therequiredmethod to check
 the field length. I'm sure this will cause other issues, but it is a
 start.

 I just added the following to my page's javascript file.

 jQuery.validator.prototype.optional = function(element) {
     // no longer callingrequiredto check string size
     // return !$.validator.methods.required.call(this, $.trim
 (element.value), element)  dependency-mismatch;
     return false;
 };

 If you find a better solution, please let me know.
 Josh

 On Oct 9, 9:09 am, Alex alex.ha...@biglotteryfund.org.uk wrote:
  Hi

  I am trying to use jquery:validationplugin by Jörn Zaefferer. Which
  works really well I have to say.

  The one limitation I am trying to work around is how I can
 runvalidationforrequiredfields before I submit a form.

  At the moment I have to submit the form before I see the error
  messages forrequiredfields I would like to see them prior as the
  user tabs through the form.

  Thanks in advance

  Alex


[jQuery] Re: [validate] Locking submit button interferes with validation plugin

2009-10-13 Thread James

Maybe something like this:

$(#myForm).bind(submit, function() {
$(this).validate(validation_options);
var valid = $(this).valid();
if (valid) {
// lock form, show loading animation, do submit
}
// you don't really need an 'else' here.
// the errors should display if it's not valid.
});


On Oct 13, 5:35 am, Opally opally@gmail.com wrote:
 This is a question about the jquery Validation plugin.

 I need to lock the submit button on some forms to prevent multiple
 submissions, but I don't want to permanently lock it, in case there's
 a validation problem that the user needs to resolve. I did come up
 with a way to temporarily lock it and change the text to Saving,
 Please Wait... for a few seconds, then revert it to an unlocked
 submit button.

 The problem I'm having is that this conflicts somehow with the jquery
 validation plugin. Some fields that have error messages if the user
 attempts to submit the form with missing data. If I use the temporary
 locking submit button (which uses an animation to create a duration)
 then these error messages do not display.

 Is it possible to test for a validation value in a separate function
 before running this lock function? If valid, lock, if not valid, don't
 lock, because it isn't possible to submit an invalid form anyway.

 I tried wrapping the locking submit function in a setTimeout, but that
 didn't have any effect at all in delaying it.


[jQuery] Re: Validate: regex that returns true elsewhere returns false inside validator method

2009-10-09 Thread w1ntermut3

Ok, it was me. Well, it was the encoding issue as discussed in the
comments on http://bassistance.de/jquery-plugins/jquery-plugin-validation/

Updating code to:
script type=text/javascript src=/js/jquery.validate-additional-
methods.js charset=ISO-8859-1/script
fixed it.


[jQuery] Re: (validate)

2009-10-08 Thread Miguel Simões
Is there any information about that function? I was looking at the code and
didn't find any reference to that function.

On Thu, Oct 8, 2009 at 01:58, Bjarki bjar...@gmail.com wrote:


 Hello Miguel,

 for part 3, you can use errorPlacement like this.

 errorPlacement: function(error, element) {
   if (element.attr('id') === yourItem.attr('id')) {
// insert the error after a given Item
error.insertAfter(givenItem);
}
else {
error.insertAfter(element);
}
 }

 hope this helps

 Regards,
 Bjarki Heiðar

 --
Regards,
-
Miguel Simões


[jQuery] Re: (validate) JSON Response for remote method

2009-10-08 Thread Bjarki

if the data is on the form {result:true}  you can use var returnObj
= JSON.parse(data) if you use http://www.json.org/json_parse.js and
return returnObj.result
you can also use

regards,
Bjarki Heiðar

On Oct 7, 9:13 am, zeussolo chris.neuhaeu...@gmail.com wrote:
 Hi all,

 I would like to use the remote method to do a validation of user data
 but I cannot configure the server-side script to simply return true
 or false. It can only return a JSON object like {result:true} or
 {result:false}. How do I have to configure the remote method to
 handle that?
 I tried to add a custom method with $.getJSON but of course, its
 result is not available yet when the custom method is called.

 $.validator.addMethod('zipcode', function(value) {
         $.getJSON('/validate.php', { module: 'validate', action: 'zipcode',
 zipcode: value }, function(data) {
                 // What to do here with data.result?
         });
         // How to return data.result here?

 }, 'Invalid areacode');

 Any help highly appreciated!

 Thanx,
 Chris


[jQuery] Re: (validate)

2009-10-08 Thread Bjarki

you can read about it herer http://docs.jquery.com/Plugins/Validation/validate

select options, there is a code example there.

On Oct 8, 6:11 pm, Miguel Simões msim...@gmail.com wrote:
 Is there any information about that function? I was looking at the code and
 didn't find any reference to that function.



 On Thu, Oct 8, 2009 at 01:58, Bjarki bjar...@gmail.com wrote:

  Hello Miguel,

  for part 3, you can use errorPlacement like this.

  errorPlacement: function(error, element) {
                if (element.attr('id') === yourItem.attr('id')) {
                         // insert the error after a given Item
                         error.insertAfter(givenItem);
                 }
                 else {
                     error.insertAfter(element);
                 }
  }

  hope this helps

  Regards,
  Bjarki Heiðar

  --

 Regards,
 -
 Miguel Simões


[jQuery] Re: (validate) How to activate validation on first blur?

2009-10-07 Thread Thomas

I believe I've found an acceptable solution that doesn't require
hacking the plugin itself.

I hope I haven't overlooked any unwanted side effects now.

I've instantiated validate like this now, essentially overwriting the
onfocusout handler:

$(myform)
.validate(
onfocusout:
function(element) {
if ( !this.checkable(element) ) {
this.element(element);
}
}
);

The original handler in the actual plugin code looks like this:
onfocusout: function(element) {
if ( !this.checkable(element)  (element.name in 
this.submitted
|| !this.optional(element)) ) {
this.element(element);
}
}


As I said, it seems to behave as required by my client now, but I'm
not entirely sure I've thought of all relevant test cases.



On Oct 7, 12:49 pm, Thomas thpick...@googlemail.com wrote:
 Hello!

 I'm using the validate plugin, and I am loving it.

 Unfortunately, my client would like to show validation errors on form
 fields on blur events every time, as opposed to showing them only if
 the user has previously entered something in the field at least once.

 Before I start hacking inside the plugin, I figured I could ask if
 there is an option that I'm just not seeing to enforce this behavior.

 Thanks for the help!


[jQuery] Re: (validate)

2009-10-07 Thread Bjarki

Hello Miguel,

for part 3, you can use errorPlacement like this.

errorPlacement: function(error, element) {
   if (element.attr('id') === yourItem.attr('id')) {
// insert the error after a given Item
error.insertAfter(givenItem);
}
else {
error.insertAfter(element);
}
}

hope this helps

Regards,
Bjarki Heiðar


On Oct 7, 10:29 pm, msimoes msim...@gmail.com wrote:
 Hello,

 I've started to use this plugin within an application I'm building,
 but I've noticed some restrictions in usage like:

 1. How to remove the label? I just wanted to be able to highlight
 the field that is a required or something, and no label. For this I've
 create a new boolean option named ignoreLabel with default value as
 false ( so it's not ignored ). I verify this each time the show label
 is called and insert it within the condition that runs before calling
 the showLabel()

 Code as follow from line 231 to 233:
         ignoreLabel: false,
         ignoreTitle: false,
         onfocusin: function(element) {

 from 598 to 599:
         if( this.settings.ignoreLabel === false )
             this.showLabel( error.element, error.message );

 from 604 to 608:
         if (this.settings.success  false === this.settings.ignoreLabel) {
                 for ( var i = 0; this.successList[i]; i++ ) {
                         this.showLabel( this.successList[i] );
                 }
         }

 I made it this way because this way I can control when I want to show
 the label by form. Suggestions?

 2. How to remove the errorClass? I just wanted the error class to
 work on the fields, and not on the label ( when I want to show it ).
 Again, I created a new string option where I define the name of the
 class that will work on the label. You can say I could do it by
 defining an input.error and a label.error or something, but that way
 would me more static.

 Code from line 633 to 634:
         if( this.settings.labelClass )
             label.removeClass().addClass( this.settings.labelClass );

 from 640 to 644:
         label = $( + this.settings.errorElement + /)
                 .attr({for:  this.idOrName(element), generated: true})
                 .html(message || );
         if( this.settings.errorLabel )
             label.addClass(this.settings.labelClass)

 3. I wanted to be able to select where the label would show, when
 using radio/checkboxes since the way the code is made, it will always
 show after the first item and not the last. With this, for now I'm
 stuck. I could use DIV but this is not really the best option since it
 will make it DIV for all items and I want to use the label for the
 other inputs. Suggestions or is there a way to do this?

 4. I have a nice bug :) when I press the submit button and there are
 errors within the form, if the error occurs for the second time,
 another label is added within the form making me have the same number
 of labels as the ones I press the submit button. The code I added
 could be reason for this or is it a known bug?

 Regards,
 -
 Miguel Simões


[jQuery] Re: validate

2009-10-04 Thread Paul Speranza

I figured it out. I had to  use the showCustomerErrors method and got
tid of focus cleanup.

On Oct 2, 10:45 am, Paul Speranza paulgspera...@gmail.com wrote:
 I am having a problem getting the error container to clear out after I
 have fixed invalid inputs. I am using the
 invalidHandler option. When my form is invalid it shows a message of
 the number of errors (taken from the sample code) and shows the
 invalid messages. After I correct each error the corresponding message
 goes away but I am still left with the message of the number of
 errors.

 Here is my setup. Can you tell me what might be wrong? Thanks

     $(#aspnetForm).validate({
         focusCleanup: true,
         onfocusout: false,
         onkeyup: false,
         submitHandler: function(form) {
             saveAnnouncement();
             return false;
         },
         invalidHandler: function(form, validator) {
             var errors = validator.numberOfInvalids();
             if (errors) {
                 var message = errors == 1
               ? 'You missed 1 field. It has been highlighted.'
               : 'You missed ' + errors + ' fields. They have been
 highlighted.';
                 $(div.error span).html(message);
                 $(div.error).show();
             } else {
                 $(div.error).hide();
             }
         },
         errorContainer: div.error,
         errorLabelContainer: div.error div,
         wrapper: p,
         rules: {
             txtStartDate: {
                 required: true,
                 date: true,
                 isDate: true
             },
             txtEndDate: {
                 required: true,
                 date: true,
                 isDate: true,
                 endDateCheck: true
             },
             txtHeading: {
                 required: true
             },
             txtMessage: {
                 required: true
             }
         },
         messages: {
             txtStartDate: {
                 required: * The start date is required.,
                 date: * The start date is not a valid date format.,
                 isDate: * The start date is not a valid date.
             },
             txtEndDate: {
                 required: * The end date is required.,
                 date: * The end date is not a valid date format.,
                 isDate: * The end date is not a valid date.,
                 endDateCheck: * The end date must be greater than or
 equal to the start date.
             },
             txtHeading: {
                 required: * The heading is required.
             },
             txtMessage: {
                 required: * The message is required.
             }

         }
     });


[jQuery] Re: validate plugin step by step form

2009-09-28 Thread James

You can create different options in a variable an assign it to
$.validate().

var option1 = {
rules: { ... }
messages: { ... }
}

var option2 = {
rules: { ... }
messages: { ... }
}

Call the appropriate one depending on which step you're in:
$(#saverForm).validate(option1);
$(#saverForm).validate(option2);


On Sep 28, 5:38 am, adexcube alfonsoenci...@gmail.com wrote:
 Hi, I'm creating a step by step form using jquery ui tabs and
 validation plugin, the problem is that I've got just one form ( and I
 have to ) so on first step the form is validated but all errors an
 others steps are displayed.
 I'm using an approach ofhttp://jquery.bassistance.de/validate/demo/multipart/
 but I've got specific messages and validations.

 Something like

 var v=$(#saverForm).validate(
         {
                 debug: true,
                 focusCleanup : false,

                 rules: {
                                 signupDetails.hasUnderstoodDeclaration : 
 required,
                                 applicantType: required,
                                 title: required,},

                 messages:{
                                 signupDetails.hasUnderstoodDeclaration : 
 Please accept The
 terms and conditions,
                                 applicantType: Please select an option.,
                                 title:          Please choose your title.,
                                 firstname:      Please enter your first 
 name.,
                                 lastname:       Please enter your surname.,

 });

 and a lot more fields.

 Is there any way I can add rules an messages to the form rather than
 add them to the fields??

 or can I create different form.validate() variables and then call them
 depending oin which step am I?
 something like

 v[0] =$(#saverForm).validate( some set of 2 rules for example )
 v[1] =$(#saverForm).validate( some set of 10 rules for example
 different than above)

 Many thanks


[jQuery] Re: Validate Text Field onblur (Bassistance Validation Plugin)

2009-09-25 Thread Dave Buchholz - I-CRE8

Not at the moment, sorry

Dave Buchholz

On Sep 25, 12:51 am, Loony2nz loony...@gmail.com wrote:
 do you have an example of this somehwere?  I think I could use this
 for upcoming forms I have in my pipeline.

 Thanks!

 On Sep 1, 10:33 am, Dave Buchholz - I-CRE8 off...@i-cre8.com wrote:

  Got it, this code onfocusout: function(element) { this.element
  (element); }, gives me what I am looking for

  Dave Buchholz


[jQuery] Re: validate - if other checked -- require input box

2009-09-25 Thread KeeganWatkins

are you using the validate plugin? i'm not familiar with it at all,
but for a simple validation like this you could do:

// DOM-ready handler
$(function() {
// Listen for onsubmit events for the form
$(#signupForm).submit(function() {
// Get the checkbox
var checkbox = $(#chkStatus5);
// True or false based on the checkbox
var checked = checkbox[0].checked;

// If its checked...
if (checked) {
// ...grab the textfield...
var text = $(#textfield);
// ...and its value
var val = text.val();

// If the textfield is empty...
if (val === ) {
// ...validation failed,
// so do something!
}
}
});
});

hope that helps.

On Sep 21, 8:38 pm, ripcurlksm kevin.mccorm...@cox.net wrote:
 I have a How did you hear about us? with a series of checkboxes that is
 working great, however there is an option for Other, where they can fill
 out their answer.

 I want to modify the script so if the checkbox for Other is selected, they
 are required to fill in the input box.

 I have this working here, but I cant get the input box to be required if
 other is selected:http://psylicyde.com/misc/jquery-validate/demo/test.html
 --
 View this message in 
 context:http://www.nabble.com/validate---if-%22other%22-checked---%3E-require...
 Sent from the jQuery General Discussion mailing list archive at Nabble.com.


[jQuery] Re: Validate Text Field onblur (Bassistance Validation Plugin)

2009-09-24 Thread Loony2nz

do you have an example of this somehwere?  I think I could use this
for upcoming forms I have in my pipeline.

Thanks!

On Sep 1, 10:33 am, Dave Buchholz - I-CRE8 off...@i-cre8.com wrote:
 Got it, this code onfocusout: function(element) { this.element
 (element); }, gives me what I am looking for

 Dave Buchholz


[jQuery] Re: (validate) temporary deactivate validate listener of fields

2009-09-17 Thread Sandler

i looked throw the docu, but couldnt find anything.
the only thread i found was this one:
http://stackoverflow.com/questions/363268/how-do-remove-jquery-validation-from-a-form
but i dont want to remove it, i just want to deactivate the validating
for a period of time, when data is set

greets

On 17 Sep., 03:57, lanxiazhi lanxia...@gmail.com wrote:
 Refer to documentation.

 2009/9/17 Sandler smike...@gmail.com





  Hi, im loading data via json dynamical from the server. Now i try to
  optimate the speed of my application and so i want to disable the
  validate of the fields during the data loading from the server.
  Is there a simple solution to this? like validate = false
  Thanks a lot and greets from austria!

  Sandler


[jQuery] Re: [validate] Help with errorPlacement

2009-09-16 Thread Jörn Zaefferer

You need to go up one more level:

errorPlacement: function(error, element){
  error.appendTo( element.parent().parent().next().find(.errorMsg) );
}

Jörn

On Wed, Sep 16, 2009 at 8:18 PM, Loony2nz loony...@gmail.com wrote:

 Hello,

 I need help with targeting a class on a TD to hold error messages with
 jQuery form validator plug-in.

 This is my sampling of code:

  script
 
 errorPlacement: function(error, element){
   error.appendTo( element.parent().next());
 }
 / script

 tr style=border:0;
    td style=border:0; align=rightFirst Namespan
 style=color:#f00;*/span/td
     td style=border:0;input maxlength=40 name=first_name
 size=20 type=text //td
 /tr
 tr style=border:0;
     td style=border:0;/td
     td class=errorMsg style=border:0;/td
 /tr

 I want to target the TD with the class: errorMsg to hold the error
 message.

 I've tried  error.appendTo( element.parent().next('.errorMsg')); to no
 avail.

 Any help would be much appreciated.

 Thanks


[jQuery] Re: [validate] Help with errorPlacement

2009-09-16 Thread Loony2nz

o...duh :)

i have to keep in mind that I have to traverse the DOM tree

Thanks :)

On Sep 16, 12:19 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 You need to go up one more level:

 errorPlacement: function(error, element){
   error.appendTo( element.parent().parent().next().find(.errorMsg) );

 }

 Jörn

 On Wed, Sep 16, 2009 at 8:18 PM, Loony2nz loony...@gmail.com wrote:

  Hello,

  I need help with targeting a class on a TD to hold error messages with
  jQuery form validator plug-in.

  This is my sampling of code:

   script
  
  errorPlacement: function(error, element){
    error.appendTo( element.parent().next());
  }
  / script

  tr style=border:0;
     td style=border:0; align=rightFirst Namespan
  style=color:#f00;*/span/td
      td style=border:0;input maxlength=40 name=first_name
  size=20 type=text //td
  /tr
  tr style=border:0;
      td style=border:0;/td
      td class=errorMsg style=border:0;/td
  /tr

  I want to target the TD with the class: errorMsg to hold the error
  message.

  I've tried  error.appendTo( element.parent().next('.errorMsg')); to no
  avail.

  Any help would be much appreciated.

  Thanks


[jQuery] Re: [validate] Custom functions onfocusin / -out

2009-09-16 Thread Jörn Zaefferer

You could also just bind focus and blur events to each element for the
same effect, without requiring a change to the plugin code.

Jörn

On Wed, Sep 16, 2009 at 11:32 PM, Philipp philipp.ma...@googlemail.com wrote:

 Hi!

 I added a nice little tweak which allows me to define custom functions
 called on (un) focussing a form element:

 jquery.validate.js got three additional lines at the end of onfocusin
 function (line 200):
                        if (this.settings.focusFunction) {
                                this.settings.focusFunction(element);
                        }
 and at the end of onfocusout function:
                        if (this.settings.blurFunction) {
                                this.settings.blurFunction(element);
                        }

 By defining a focusFunction / blurFunction within a jQuery
 ('#...').validate({})-block I was able to add a custom behaviour to
 those two events without writing additional JavaScript code. In my
 case I simply display or hide a div containing some help for the form
 element.

 Maybe this little code change will help somebody or even find its way
 to the official release.

 Kind regards and thank you for your validator!
  Philipp



[jQuery] Re: (validate), submitHandler and custom function

2009-09-16 Thread bgumbiker

Any Idea?
thanks

On Sep 15, 12:17 pm, bgumbiker bogumil.bial...@gmail.com wrote:
 Indeed the message is sent with $.post(...) however it looks like the
 following code is not called:

 jQuery.ajaxSetup({
   'beforeSend': function(xhr) {xhr.setRequestHeader(Accept, text/
 javascript)}

 });

 and the server side code does not handle the request properly.

 Thanks!
 Bogumil

 On Sep 13, 10:01 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  Try this:

  submitHandler: function(form) {
    $.post(form.action, $(this).serialize(), null, script);

  }

  Jörn

  On Sun, Sep 13, 2009 at 12:42 AM, bgumbiker bogumil.bial...@gmail.com 
  wrote:

   Hello,
   I am looking for a way to call successfully custom function from
   submitHandler to do proper ajax post.

   Here is my custom function:

   jQuery.fn.submitWithAjax = function() {
    this.submit(function() {
      $.post(this.action, $(this).serialize(), null, script);
      return false;
    })
    return this;
   };

   Before using validate plugin I had following which worked fine:

   $(document).ready(function() {
     $(#my_form).submitWithAjax();
    }

   Now I have added the validation part and have no idea how to call my
   custom submitWithAjax function??

   $(document).ready(function() {

      $(#my_form).validate({

                  /*Validations - works perfectly!! */

               },

               submitHandler: function(form) {

               /* $(#my_form).submitWithAjax(); - this works but
   introduces recursion */

               /* how to call custom subitWithAjax() ? */

               }

          });
   })

   Thanks!


[jQuery] Re: (validate) temporary deactivate validate listener of fields

2009-09-16 Thread lanxiazhi
Refer to documentation.

2009/9/17 Sandler smike...@gmail.com


 Hi, im loading data via json dynamical from the server. Now i try to
 optimate the speed of my application and so i want to disable the
 validate of the fields during the data loading from the server.
 Is there a simple solution to this? like validate = false
 Thanks a lot and greets from austria!

 Sandler



[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Whats wrong with keeping the focus on the active field, if its invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

 I've been building up my validation using the jquery validation plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the cursor
 was left in a field and submitted then the focus stays there (if it's
 invalid) rather than jump to the first invalid input.  From what I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus to
 that?

 A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js




[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

Thanks for your help.  You always seem to be very quick to respond and
I, along with everyone else I'm sure, am very appreciative.

Great plugin!

On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 You shouldn't use visible-required as the method name. Stick with a
 valid JavaScript identifier (probably should have mentioned that).

 As long as you do that, you can use addMethod to alias existing
 methods with other default messages. On the other hand, addClassRules
 doesn't help at all with messages.

 Jörn

 On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

  I'm using the validate plugin to validate ASP.NET webforms on the
  client (I'd prefer to not use webforms, but for now I'm stuck with
  it).  Because I'm using webforms, I'm trying to get around using the
  clientID of server controls.  The metadata plugin works great, but I'd
  prefer to not use it because it's gonna blow up my markup.

  Is there any way to utilize jQuery.validator.addClassRules to add
  custom messages to a rule?  Take the following for instance:

  jQuery.validator.addMethod(visible-required, function(value,
  element) {
     return $(element).is(:hidden) || !this.optional(element);
  }, This is required when visible);

  jQuery.validator.addClassRules(fool, {
     visible-required: true,
     lettersonly: true,
     messages: {
         visible-required: My specific field must is required,
         lettersonly: Letters only fool!
     }
  });

  On a slightly related note, is there any overhead associated with
  adding custom validation methods specific to some field only to
  override the default message?  Take the following:

  jQuery.validator.addMethod(visible-required, function(value,
  element) {
     return $(element).is(:hidden) || !this.optional(element);
  }, This is required when visible);

  jQuery.validator.addMethod(visible-required-fool,
     jQuery.validator.methods.visible - required,
     My specific field is required);

  I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

Sorry for the spam, fixing the subject

On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
 Thanks for your help.  You always seem to be very quick to respond and
 I, along with everyone else I'm sure, am very appreciative.

 Great plugin!

 On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  You shouldn't use visible-required as the method name. Stick with a
  valid JavaScript identifier (probably should have mentioned that).

  As long as you do that, you can use addMethod to alias existing
  methods with other default messages. On the other hand, addClassRules
  doesn't help at all with messages.

  Jörn

  On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

   I'm using the validate plugin to validate ASP.NET webforms on the
   client (I'd prefer to not use webforms, but for now I'm stuck with
   it).  Because I'm using webforms, I'm trying to get around using the
   clientID of server controls.  The metadata plugin works great, but I'd
   prefer to not use it because it's gonna blow up my markup.

   Is there any way to utilize jQuery.validator.addClassRules to add
   custom messages to a rule?  Take the following for instance:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addClassRules(fool, {
      visible-required: true,
      lettersonly: true,
      messages: {
          visible-required: My specific field must is required,
          lettersonly: Letters only fool!
      }
   });

   On a slightly related note, is there any overhead associated with
   adding custom validation methods specific to some field only to
   override the default message?  Take the following:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addMethod(visible-required-fool,
      jQuery.validator.methods.visible - required,
      My specific field is required);

   I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

You shouldn't use visible-required as the method name. Stick with a
valid JavaScript identifier (probably should have mentioned that).

As long as you do that, you can use addMethod to alias existing
methods with other default messages. On the other hand, addClassRules
doesn't help at all with messages.

Jörn

On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

 I'm using the validate plugin to validate ASP.NET webforms on the
 client (I'd prefer to not use webforms, but for now I'm stuck with
 it).  Because I'm using webforms, I'm trying to get around using the
 clientID of server controls.  The metadata plugin works great, but I'd
 prefer to not use it because it's gonna blow up my markup.

 Is there any way to utilize jQuery.validator.addClassRules to add
 custom messages to a rule?  Take the following for instance:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
    return $(element).is(:hidden) || !this.optional(element);
 }, This is required when visible);

 jQuery.validator.addClassRules(fool, {
    visible-required: true,
    lettersonly: true,
    messages: {
        visible-required: My specific field must is required,
        lettersonly: Letters only fool!
    }
 });

 On a slightly related note, is there any overhead associated with
 adding custom validation methods specific to some field only to
 override the default message?  Take the following:

 jQuery.validator.addMethod(visible-required, function(value,
 element) {
    return $(element).is(:hidden) || !this.optional(element);
 }, This is required when visible);

 jQuery.validator.addMethod(visible-required-fool,
    jQuery.validator.methods.visible - required,
    My specific field is required);

 I saw your talk at the conference last weekend btw.  Thanks



[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

I actually changed the plugin page to ask for (validate). When you
use Google Groups in an email client, the subject is displayed just
fined, while the Web interface removes the prefix.

Jörn

On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

 Sorry for the spam, fixing the subject

 On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
 Thanks for your help.  You always seem to be very quick to respond and
 I, along with everyone else I'm sure, am very appreciative.

 Great plugin!

 On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  You shouldn't use visible-required as the method name. Stick with a
  valid JavaScript identifier (probably should have mentioned that).

  As long as you do that, you can use addMethod to alias existing
  methods with other default messages. On the other hand, addClassRules
  doesn't help at all with messages.

  Jörn

  On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com wrote:

   I'm using the validate plugin to validate ASP.NET webforms on the
   client (I'd prefer to not use webforms, but for now I'm stuck with
   it).  Because I'm using webforms, I'm trying to get around using the
   clientID of server controls.  The metadata plugin works great, but I'd
   prefer to not use it because it's gonna blow up my markup.

   Is there any way to utilize jQuery.validator.addClassRules to add
   custom messages to a rule?  Take the following for instance:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addClassRules(fool, {
      visible-required: true,
      lettersonly: true,
      messages: {
          visible-required: My specific field must is required,
          lettersonly: Letters only fool!
      }
   });

   On a slightly related note, is there any overhead associated with
   adding custom validation methods specific to some field only to
   override the default message?  Take the following:

   jQuery.validator.addMethod(visible-required, function(value,
   element) {
      return $(element).is(:hidden) || !this.optional(element);
   }, This is required when visible);

   jQuery.validator.addMethod(visible-required-fool,
      jQuery.validator.methods.visible - required,
      My specific field is required);

   I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Dr Stevens

gotcha, figured that out after my last post.

I actually got here from your last comment on http://bassistance.de/
jquery-plugins/jquery-plugin-validation/.  I will make note to use
(validate) instead.

On Sep 15, 12:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 I actually changed the plugin page to ask for (validate). When you
 use Google Groups in an email client, the subject is displayed just
 fined, while the Web interface removes the prefix.

 Jörn

 On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

  Sorry for the spam, fixing the subject

  On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
  Thanks for your help.  You always seem to be very quick to respond and
  I, along with everyone else I'm sure, am very appreciative.

  Great plugin!

  On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   You shouldn't use visible-required as the method name. Stick with a
   valid JavaScript identifier (probably should have mentioned that).

   As long as you do that, you can use addMethod to alias existing
   methods with other default messages. On the other hand, addClassRules
   doesn't help at all with messages.

   Jörn

   On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com 
   wrote:

I'm using the validate plugin to validate ASP.NET webforms on the
client (I'd prefer to not use webforms, but for now I'm stuck with
it).  Because I'm using webforms, I'm trying to get around using the
clientID of server controls.  The metadata plugin works great, but I'd
prefer to not use it because it's gonna blow up my markup.

Is there any way to utilize jQuery.validator.addClassRules to add
custom messages to a rule?  Take the following for instance:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addClassRules(fool, {
   visible-required: true,
   lettersonly: true,
   messages: {
       visible-required: My specific field must is required,
       lettersonly: Letters only fool!
   }
});

On a slightly related note, is there any overhead associated with
adding custom validation methods specific to some field only to
override the default message?  Take the following:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visible-required-fool,
   jQuery.validator.methods.visible - required,
   My specific field is required);

I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: [validate] custom validation messages

2009-09-15 Thread Jörn Zaefferer

Ah, thanks for the hint, forgot to update that comment. Fixed it now!

Jörn

On Tue, Sep 15, 2009 at 6:52 PM, Dr Stevens daverstev...@gmail.com wrote:

 gotcha, figured that out after my last post.

 I actually got here from your last comment on http://bassistance.de/
 jquery-plugins/jquery-plugin-validation/.  I will make note to use
 (validate) instead.

 On Sep 15, 12:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 I actually changed the plugin page to ask for (validate). When you
 use Google Groups in an email client, the subject is displayed just
 fined, while the Web interface removes the prefix.

 Jörn

 On Tue, Sep 15, 2009 at 6:40 PM, Dr Stevens daverstev...@gmail.com wrote:

  Sorry for the spam, fixing the subject

  On Sep 15, 12:39 pm, Dr Stevens daverstev...@gmail.com wrote:
  Thanks for your help.  You always seem to be very quick to respond and
  I, along with everyone else I'm sure, am very appreciative.

  Great plugin!

  On Sep 15, 12:35 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   You shouldn't use visible-required as the method name. Stick with a
   valid JavaScript identifier (probably should have mentioned that).

   As long as you do that, you can use addMethod to alias existing
   methods with other default messages. On the other hand, addClassRules
   doesn't help at all with messages.

   Jörn

   On Tue, Sep 15, 2009 at 5:32 PM, Dr Stevens daverstev...@gmail.com 
   wrote:

I'm using the validate plugin to validate ASP.NET webforms on the
client (I'd prefer to not use webforms, but for now I'm stuck with
it).  Because I'm using webforms, I'm trying to get around using the
clientID of server controls.  The metadata plugin works great, but I'd
prefer to not use it because it's gonna blow up my markup.

Is there any way to utilize jQuery.validator.addClassRules to add
custom messages to a rule?  Take the following for instance:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addClassRules(fool, {
   visible-required: true,
   lettersonly: true,
   messages: {
       visible-required: My specific field must is required,
       lettersonly: Letters only fool!
   }
});

On a slightly related note, is there any overhead associated with
adding custom validation methods specific to some field only to
override the default message?  Take the following:

jQuery.validator.addMethod(visible-required, function(value,
element) {
   return $(element).is(:hidden) || !this.optional(element);
}, This is required when visible);

jQuery.validator.addMethod(visible-required-fool,
   jQuery.validator.methods.visible - required,
   My specific field is required);

I saw your talk at the conference last weekend btw.  Thanks


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.




On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Whats wrong with keeping the focus on the active field, if its invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that are
 invalid, why move the focus to a different field?

 Jörn



 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation plugin
  but I can't work out how to get a failed validation to default the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the cursor
  was left in a field and submitted then the focus stays there (if it's
  invalid) rather than jump to the first invalid input.  From what I've
  read and seen, this is the expected behaviour but not what I want.

  Is there a way I can get the first invalid field and set the focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Well, you can set focusInvalid: false and implement invalidHandler to
focus the first field. That should do the trick.

Jörn

On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 And what if you enter an invalid character in an input at the bottom
 of the field? For example entering a letter in the Conference Dinner
 input of my sample form.

 A user is going to miss the error message at the top of the form along
 with other input errors if there's an error in the last inputs of my
 example form and is going to have submit multiple times before they
 may even be aware of other errors.

 I'd expected jumping to the first invalid input to be standard
 behaviour.  My fault there I guess.




 On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Whats wrong with keeping the focus on the active field, if its invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that are
 invalid, why move the focus to a different field?

 Jörn



 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation plugin
  but I can't work out how to get a failed validation to default the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the cursor
  was left in a field and submitted then the focus stays there (if it's
  invalid) rather than jump to the first invalid input.  From what I've
  read and seen, this is the expected behaviour but not what I want.

  Is there a way I can get the first invalid field and set the focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

I guess I'm going to have too.  I just need to work out how to return
the first invalid field so I can set the focus.



On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Well, you can set focusInvalid: false and implement invalidHandler to
 focus the first field. That should do the trick.

 Jörn



 On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  And what if you enter an invalid character in an input at the bottom
  of the field? For example entering a letter in the Conference Dinner
  input of my sample form.

  A user is going to miss the error message at the top of the form along
  with other input errors if there's an error in the last inputs of my
  example form and is going to have submit multiple times before they
  may even be aware of other errors.

  I'd expected jumping to the first invalid input to be standard
  behaviour.  My fault there I guess.

  On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Whats wrong with keeping the focus on the active field, if its invalid?

  If you enter something into the, say, third field, hit enter to
  submit, then it turns out both that field and another before that are
  invalid, why move the focus to a different field?

  Jörn

  On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com wrote:

   I've been building up my validation using the jquery validation plugin
   but I can't work out how to get a failed validation to default the
   focus to the first invalid input rather than to the last selected
   input.

   If there is no input field selected, when I submit then a failed
   validation will focus the cursor on the first field but if the cursor
   was left in a field and submitted then the focus stays there (if it's
   invalid) rather than jump to the first invalid input.  From what I've
   read and seen, this is the expected behaviour but not what I want.

   Is there a way I can get the first invalid field and set the focus to
   that?

   A demo of what I have built up so far can be seen at
  https://webdev2.otago.ac.nz/oihrn2009/

   All my jquery validation can be found in
  https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

Something like this?

$(form).validate({
  focusInvalid: false,
  invalidHandler: function() {
$(this).find(:input.error:first).focus();
  }
});

Jörn

On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 I guess I'm going to have too.  I just need to work out how to return
 the first invalid field so I can set the focus.



 On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Well, you can set focusInvalid: false and implement invalidHandler to
 focus the first field. That should do the trick.

 Jörn



 On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  And what if you enter an invalid character in an input at the bottom
  of the field? For example entering a letter in the Conference Dinner
  input of my sample form.

  A user is going to miss the error message at the top of the form along
  with other input errors if there's an error in the last inputs of my
  example form and is going to have submit multiple times before they
  may even be aware of other errors.

  I'd expected jumping to the first invalid input to be standard
  behaviour.  My fault there I guess.

  On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Whats wrong with keeping the focus on the active field, if its invalid?

  If you enter something into the, say, third field, hit enter to
  submit, then it turns out both that field and another before that are
  invalid, why move the focus to a different field?

  Jörn

  On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I've been building up my validation using the jquery validation plugin
   but I can't work out how to get a failed validation to default the
   focus to the first invalid input rather than to the last selected
   input.

   If there is no input field selected, when I submit then a failed
   validation will focus the cursor on the first field but if the cursor
   was left in a field and submitted then the focus stays there (if it's
   invalid) rather than jump to the first invalid input.  From what I've
   read and seen, this is the expected behaviour but not what I want.

   Is there a way I can get the first invalid field and set the focus to
   that?

   A demo of what I have built up so far can be seen at
  https://webdev2.otago.ac.nz/oihrn2009/

   All my jquery validation can be found in
  https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Damn.  I always forget about :first.

Thanks.



On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Something like this?

 $(form).validate({
   focusInvalid: false,
   invalidHandler: function() {
     $(this).find(:input.error:first).focus();
   }

 });

 Jörn



 On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  I guess I'm going to have too.  I just need to work out how to return
  the first invalid field so I can set the focus.

  On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:
  Well, you can set focusInvalid: false and implement invalidHandler to
  focus the first field. That should do the trick.

  Jörn

  On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   And what if you enter an invalid character in an input at the bottom
   of the field? For example entering a letter in the Conference Dinner
   input of my sample form.

   A user is going to miss the error message at the top of the form along
   with other input errors if there's an error in the last inputs of my
   example form and is going to have submit multiple times before they
   may even be aware of other errors.

   I'd expected jumping to the first invalid input to be standard
   behaviour.  My fault there I guess.

   On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Whats wrong with keeping the focus on the active field, if its invalid?

   If you enter something into the, say, third field, hit enter to
   submit, then it turns out both that field and another before that are
   invalid, why move the focus to a different field?

   Jörn

   On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

I've been building up my validation using the jquery validation plugin
but I can't work out how to get a failed validation to default the
focus to the first invalid input rather than to the last selected
input.

If there is no input field selected, when I submit then a failed
validation will focus the cursor on the first field but if the cursor
was left in a field and submitted then the focus stays there (if it's
invalid) rather than jump to the first invalid input.  From what I've
read and seen, this is the expected behaviour but not what I want.

Is there a way I can get the first invalid field and set the focus to
that?

A demo of what I have built up so far can be seen at
   https://webdev2.otago.ac.nz/oihrn2009/

All my jquery validation can be found in
   https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: (validate) email validator

2009-09-15 Thread Scott Haneda


Right, this is sort of a long debate, which I see pop up on mailing  
lists for email servers.  In the end, I think you need to go by the  
standards.


Just because hotmail breaks the rules, does not mean you want to  
punish some other user who does not use hotmail, just because they use  
a character in their email address that hotmail does not.


On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote:


While technically this is correct, a more restrictive approach might
be preferable because some email services (hotmail for one) will not
send to an email address using anything other than alphanumerics,
dots, hyphens, and underscores.


--
Scott * If you contact me off list replace talklists@ with scott@ *



[jQuery] Re: (validate) email validator

2009-09-15 Thread Jörn Zaefferer

Yep. The goal here is to indicate to the user that he mistyped his
address. For that to work reliably, the validation must accept all
valid addresses, not just those that feel more valid then others.

Jörn

On Tue, Sep 15, 2009 at 10:39 PM, Scott Haneda talkli...@newgeo.com wrote:

 Right, this is sort of a long debate, which I see pop up on mailing lists
 for email servers.  In the end, I think you need to go by the standards.

 Just because hotmail breaks the rules, does not mean you want to punish some
 other user who does not use hotmail, just because they use a character in
 their email address that hotmail does not.

 On Sep 14, 2009, at 6:04 PM, Sean McKenna wrote:

 While technically this is correct, a more restrictive approach might
 be preferable because some email services (hotmail for one) will not
 send to an email address using anything other than alphanumerics,
 dots, hyphens, and underscores.

 --
 Scott * If you contact me off list replace talklists@ with scott@ *




[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Hmmm...I tried this but I discovered on the first submit that it
doesn't focus the first invalid field but it will if I hit return to
submit again.

Also, when hitting submit on a field that's not checked for validity,
the form will submit successfully this second time as well despite
still having invalid fields.

You can test it out using my sample form from the OP.


On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
 Damn.  I always forget about :first.

 Thanks.

 On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:



  Something like this?

  $(form).validate({
    focusInvalid: false,
    invalidHandler: function() {
      $(this).find(:input.error:first).focus();
    }

  });

  Jörn

  On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I guess I'm going to have too.  I just need to work out how to return
   the first invalid field so I can set the focus.

   On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Well, you can set focusInvalid: false and implement invalidHandler to
   focus the first field. That should do the trick.

   Jörn

   On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.

On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Whats wrong with keeping the focus on the active field, if its 
invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
wrote:

 I've been building up my validation using the jquery validation 
 plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the 
 cursor
 was left in a field and submitted then the focus stays there (if 
 it's
 invalid) rather than jump to the first invalid input.  From what 
 I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus 
 to
 that?

 A demo of what I have built up so far can be seen at
https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Jörn Zaefferer

I can't reproduce that. Seems to work fine for me.

Jörn

On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey geoffreydhug...@gmail.com wrote:

 Hmmm...I tried this but I discovered on the first submit that it
 doesn't focus the first invalid field but it will if I hit return to
 submit again.

 Also, when hitting submit on a field that's not checked for validity,
 the form will submit successfully this second time as well despite
 still having invalid fields.

 You can test it out using my sample form from the OP.


 On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
 Damn.  I always forget about :first.

 Thanks.

 On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:



  Something like this?

  $(form).validate({
    focusInvalid: false,
    invalidHandler: function() {
      $(this).find(:input.error:first).focus();
    }

  });

  Jörn

  On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   I guess I'm going to have too.  I just need to work out how to return
   the first invalid field so I can set the focus.

   On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:
   Well, you can set focusInvalid: false and implement invalidHandler to
   focus the first field. That should do the trick.

   Jörn

   On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

And what if you enter an invalid character in an input at the bottom
of the field? For example entering a letter in the Conference Dinner
input of my sample form.

A user is going to miss the error message at the top of the form along
with other input errors if there's an error in the last inputs of my
example form and is going to have submit multiple times before they
may even be aware of other errors.

I'd expected jumping to the first invalid input to be standard
behaviour.  My fault there I guess.

On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Whats wrong with keeping the focus on the active field, if its 
invalid?

If you enter something into the, say, third field, hit enter to
submit, then it turns out both that field and another before that are
invalid, why move the focus to a different field?

Jörn

On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey geoffreydhug...@gmail.com 
wrote:

 I've been building up my validation using the jquery validation 
 plugin
 but I can't work out how to get a failed validation to default the
 focus to the first invalid input rather than to the last selected
 input.

 If there is no input field selected, when I submit then a failed
 validation will focus the cursor on the first field but if the 
 cursor
 was left in a field and submitted then the focus stays there (if 
 it's
 invalid) rather than jump to the first invalid input.  From what 
 I've
 read and seen, this is the expected behaviour but not what I want.

 Is there a way I can get the first invalid field and set the focus 
 to
 that?

 A demo of what I have built up so far can be seen at
https://webdev2.otago.ac.nz/oihrn2009/

 All my jquery validation can be found in
https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Not for me.

In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3
under XP:

Click in a required field (not the first one) and hit return.  Focus
stays in the focused field.  Hit return again and the focus jumps to
the first invalid field.

If you focus a non-required field and hit return, the focus stays in
the non-required field but you do get the error messages for invalid
fields.  If you hit return again, the focus jumps to the first invalid
field but then the form submits successfully.


In Internet Explorer 7 under XP:

Click in required field (not the first one) and hit return.  Focus
stays in the focused field.  Hit return again and the focus stays in
the focused field.

If you focus on a non-required element and hit return, the focus jumps
to the first invalid field.







On Sep 16, 9:44 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 I can't reproduce that. Seems to work fine for me.

 Jörn



 On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey geoffreydhug...@gmail.com wrote:

  Hmmm...I tried this but I discovered on the first submit that it
  doesn't focus the first invalid field but it will if I hit return to
  submit again.

  Also, when hitting submit on a field that's not checked for validity,
  the form will submit successfully this second time as well despite
  still having invalid fields.

  You can test it out using my sample form from the OP.

  On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
  Damn.  I always forget about :first.

  Thanks.

  On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   Something like this?

   $(form).validate({
     focusInvalid: false,
     invalidHandler: function() {
       $(this).find(:input.error:first).focus();
     }

   });

   Jörn

   On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
   wrote:

I guess I'm going to have too.  I just need to work out how to return
the first invalid field so I can set the focus.

On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
Well, you can set focusInvalid: false and implement invalidHandler to
focus the first field. That should do the trick.

Jörn

On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey 
geoffreydhug...@gmail.com wrote:

 And what if you enter an invalid character in an input at the bottom
 of the field? For example entering a letter in the Conference Dinner
 input of my sample form.

 A user is going to miss the error message at the top of the form 
 along
 with other input errors if there's an error in the last inputs of my
 example form and is going to have submit multiple times before they
 may even be aware of other errors.

 I'd expected jumping to the first invalid input to be standard
 behaviour.  My fault there I guess.

 On Sep 15, 10:08 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Whats wrong with keeping the focus on the active field, if its 
 invalid?

 If you enter something into the, say, third field, hit enter to
 submit, then it turns out both that field and another before that 
 are
 invalid, why move the focus to a different field?

 Jörn

 On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey 
 geoffreydhug...@gmail.com wrote:

  I've been building up my validation using the jquery validation 
  plugin
  but I can't work out how to get a failed validation to default 
  the
  focus to the first invalid input rather than to the last selected
  input.

  If there is no input field selected, when I submit then a failed
  validation will focus the cursor on the first field but if the 
  cursor
  was left in a field and submitted then the focus stays there (if 
  it's
  invalid) rather than jump to the first invalid input.  From what 
  I've
  read and seen, this is the expected behaviour but not what I 
  want.

  Is there a way I can get the first invalid field and set the 
  focus to
  that?

  A demo of what I have built up so far can be seen at
 https://webdev2.otago.ac.nz/oihrn2009/

  All my jquery validation can be found in
 https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: Validate: Focus on first invalid field after validation

2009-09-15 Thread Geoffrey

Ok, the problem with the non-validated fields submitting on hitting
return twice is resolved by removing the following...

onfocusout: function(element) {
$(element).valid();
},

The problem is, I want this as I want an error to show if they tab
through required fields and leave them blank.

It doesn't resolve the issue of the first submit still focusing on the
last field focused and the second submit then moving the focus.



On Sep 16, 10:00 am, Geoffrey geoffreydhug...@gmail.com wrote:
 Not for me.

 In Safari 4 and Firefox 3.5.3 under Snow Leopard and Firefox 3.5.3
 under XP:

 Click in a required field (not the first one) and hit return.  Focus
 stays in the focused field.  Hit return again and the focus jumps to
 the first invalid field.

 If you focus a non-required field and hit return, the focus stays in
 the non-required field but you do get the error messages for invalid
 fields.  If you hit return again, the focus jumps to the first invalid
 field but then the form submits successfully.

 In Internet Explorer 7 under XP:

 Click in required field (not the first one) and hit return.  Focus
 stays in the focused field.  Hit return again and the focus stays in
 the focused field.

 If you focus on a non-required element and hit return, the focus jumps
 to the first invalid field.

 On Sep 16, 9:44 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:



  I can't reproduce that. Seems to work fine for me.

  Jörn

  On Tue, Sep 15, 2009 at 11:40 PM, Geoffrey geoffreydhug...@gmail.com 
  wrote:

   Hmmm...I tried this but I discovered on the first submit that it
   doesn't focus the first invalid field but it will if I hit return to
   submit again.

   Also, when hitting submit on a field that's not checked for validity,
   the form will submit successfully this second time as well despite
   still having invalid fields.

   You can test it out using my sample form from the OP.

   On Sep 16, 8:37 am, Geoffrey geoffreydhug...@gmail.com wrote:
   Damn.  I always forget about :first.

   Thanks.

   On Sep 16, 8:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
   wrote:

Something like this?

$(form).validate({
  focusInvalid: false,
  invalidHandler: function() {
    $(this).find(:input.error:first).focus();
  }

});

Jörn

On Tue, Sep 15, 2009 at 10:24 PM, Geoffrey geoffreydhug...@gmail.com 
wrote:

 I guess I'm going to have too.  I just need to work out how to return
 the first invalid field so I can set the focus.

 On Sep 16, 8:16 am, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:
 Well, you can set focusInvalid: false and implement invalidHandler 
 to
 focus the first field. That should do the trick.

 Jörn

 On Tue, Sep 15, 2009 at 10:01 PM, Geoffrey 
 geoffreydhug...@gmail.com wrote:

  And what if you enter an invalid character in an input at the 
  bottom
  of the field? For example entering a letter in the Conference 
  Dinner
  input of my sample form.

  A user is going to miss the error message at the top of the form 
  along
  with other input errors if there's an error in the last inputs of 
  my
  example form and is going to have submit multiple times before 
  they
  may even be aware of other errors.

  I'd expected jumping to the first invalid input to be standard
  behaviour.  My fault there I guess.

  On Sep 15, 10:08 pm, Jörn Zaefferer 
  joern.zaeffe...@googlemail.com
  wrote:
  Whats wrong with keeping the focus on the active field, if its 
  invalid?

  If you enter something into the, say, third field, hit enter to
  submit, then it turns out both that field and another before 
  that are
  invalid, why move the focus to a different field?

  Jörn

  On Tue, Sep 8, 2009 at 4:47 AM, Geoffrey 
  geoffreydhug...@gmail.com wrote:

   I've been building up my validation using the jquery 
   validation plugin
   but I can't work out how to get a failed validation to default 
   the
   focus to the first invalid input rather than to the last 
   selected
   input.

   If there is no input field selected, when I submit then a 
   failed
   validation will focus the cursor on the first field but if the 
   cursor
   was left in a field and submitted then the focus stays there 
   (if it's
   invalid) rather than jump to the first invalid input.  From 
   what I've
   read and seen, this is the expected behaviour but not what I 
   want.

   Is there a way I can get the first invalid field and set the 
   focus to
   that?

   A demo of what I have built up so far can be seen at
  https://webdev2.otago.ac.nz/oihrn2009/

   All my jquery validation can be found in
  https://webdev2.otago.ac.nz/oihrn2009/javascript/document.ready.all.js


[jQuery] Re: (validate) dash/hyphen in radio id problem

2009-09-14 Thread mattso

I've tried using the quotes on names that don't have a dash in it and
this works, but it won't work with the ones that do contain a dash (-)
(they are radio buttons)
Is this really supposed to work ?

Any clue would be appreciated


On 11 sep, 16:03, mattso matthieu.larc...@gmail.com wrote:
 Thanks for your reply, Jörn.

 I've tried :

 rules: {
         genre-f: genreCheck,
         genre-m: genreCheck

 }

 and :

 rules: {
         genre-f: {
                 genreCheck: true
         },
         genre-m: {
                 genreCheck: true
         }

 }

 with :

 $.validator.addMethod('genreCheck', function (value) {
         alert('called');
         if( $(#genre-f).is(:checked) || $(#genre-m).is(:checked) ){
                 return true;
         }else{
                 return false;
         }

 }, Please select a genre.);

 but I don't get any error message and the alert in the genreCheck
 function shows it's not even called.
 Any idea why ?

 On 11 sep, 15:40, Jörn Zaefferer joern.zaeffe...@googlemail.com
 wrote:

  Seehttp://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl...

  Jörn

  On Fri, Sep 11, 2009 at 2:26 PM, mattso matthieu.larc...@gmail.com wrote:

   Hi,

   I'm using the bassistance.de Validation Plugin for jQuery and I have
   the following problem :

   When using a dash(-) separated id for genres (i.e. genre-f / genre-m),
   I get the following js error : missing : after property id with the
   following code:
   rules: {
          genre-f: {
                  required: #genre-m
          },
          genre-m: {
                  required: function() {
                          return $(#genre-f).is(:checked);
                  }
          },
   It seems that the js (json?) doesn't allow the use of a - inside a
   variable name.

   Unfortunately, I can't change the id names, as they are being
   generated by Zend Framework which doesn't allow to replace it with
   another character.

   Anybody would know a way around this ?

   It seems to me that in the case of multi-options inputs, the script
   should focus on the name instead of the id...
   Any clue would be appreciated.


[jQuery] Re: (validate) dash/hyphen in radio id problem

2009-09-14 Thread mattso

I tried building a testcase and it appeared that the problem was not
id-with-dash related, it's the radio buttons validation that simply
wasn't working at all !

There's a demo of radio buttons validating at
http://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo.html
but it is using the validate=required:true attribute to do so, and
this breaks the w3c validation of the code...

I've eventually found by trial and error that it is working if I use
the name attribute instead of the id attribute in the rules :
rules: {
genre: {
required: true
}
}

Now I just have to sort out the place where the error message is
displayed and that'll be fine.
I hope this can help others when they encounter that same problem...


On 14 sep, 13:31, mattso matthieu.larc...@gmail.com wrote:
 I've tried using the quotes on names that don't have a dash in it and
 this works, but it won't work with the ones that do contain a dash (-)
 (they are radio buttons)
 Is this really supposed to work ?

 Any clue would be appreciated

 On 11 sep, 16:03, mattso matthieu.larc...@gmail.com wrote:

  Thanks for your reply, Jörn.

  I've tried :

  rules: {
          genre-f: genreCheck,
          genre-m: genreCheck

  }

  and :

  rules: {
          genre-f: {
                  genreCheck: true
          },
          genre-m: {
                  genreCheck: true
          }

  }

  with :

  $.validator.addMethod('genreCheck', function (value) {
          alert('called');
          if( $(#genre-f).is(:checked) || $(#genre-m).is(:checked) ){
                  return true;
          }else{
                  return false;
          }

  }, Please select a genre.);

  but I don't get any error message and the alert in the genreCheck
  function shows it's not even called.
  Any idea why ?

  On 11 sep, 15:40, Jörn Zaefferer joern.zaeffe...@googlemail.com
  wrote:

   Seehttp://docs.jquery.com/Plugins/Validation/Reference#Fields_with_compl...

   Jörn

   On Fri, Sep 11, 2009 at 2:26 PM, mattso matthieu.larc...@gmail.com 
   wrote:

Hi,

I'm using the bassistance.de Validation Plugin for jQuery and I have
the following problem :

When using a dash(-) separated id for genres (i.e. genre-f / genre-m),
I get the following js error : missing : after property id with the
following code:
rules: {
       genre-f: {
               required: #genre-m
       },
       genre-m: {
               required: function() {
                       return $(#genre-f).is(:checked);
               }
       },
It seems that the js (json?) doesn't allow the use of a - inside a
variable name.

Unfortunately, I can't change the id names, as they are being
generated by Zend Framework which doesn't allow to replace it with
another character.

Anybody would know a way around this ?

It seems to me that in the case of multi-options inputs, the script
should focus on the name instead of the id...
Any clue would be appreciated.


[jQuery] Re: (validate) email validator

2009-09-14 Thread Scott Haneda


The one letter for tld is probably a bug.  The characters you list are  
legal to the left if the last @ sign.


--
Scott
Iphone says hello.

On Sep 14, 2009, at 10:59 AM, mattso matthieu.larc...@gmail.com wrote:



How come the validator for emails only needs one letter for the tld
and allows non valid characters like / or * ?


[jQuery] Re: (validate) email validator

2009-09-14 Thread Sean McKenna

While technically this is correct, a more restrictive approach might
be preferable because some email services (hotmail for one) will not
send to an email address using anything other than alphanumerics,
dots, hyphens, and underscores.

On Sep 14, 11:02 am, Scott Haneda talkli...@newgeo.com wrote:
 The one letter for tld is probably a bug.  The characters you list are  
 legal to the left if the last @ sign.

 --
 Scott
 Iphone says hello.

 On Sep 14, 2009, at 10:59 AM, mattso matthieu.larc...@gmail.com wrote:



  How come the validator for emails only needs one letter for the tld
  and allows non valid characters like / or * ?


[jQuery] Re: (validate), submitHandler and custom function

2009-09-14 Thread bgumbiker


Indeed the message is sent with $.post(...) however it looks like the
following code is not called:

jQuery.ajaxSetup({
  'beforeSend': function(xhr) {xhr.setRequestHeader(Accept, text/
javascript)}
});


and the server side code does not handle the request properly.

Thanks!
Bogumil





On Sep 13, 10:01 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com
wrote:
 Try this:

 submitHandler: function(form) {
   $.post(form.action, $(this).serialize(), null, script);

 }

 Jörn

 On Sun, Sep 13, 2009 at 12:42 AM, bgumbiker bogumil.bial...@gmail.com wrote:

  Hello,
  I am looking for a way to call successfully custom function from
  submitHandler to do proper ajax post.

  Here is my custom function:

  jQuery.fn.submitWithAjax = function() {
   this.submit(function() {
     $.post(this.action, $(this).serialize(), null, script);
     return false;
   })
   return this;
  };

  Before using validate plugin I had following which worked fine:

  $(document).ready(function() {
    $(#my_form).submitWithAjax();
   }

  Now I have added the validation part and have no idea how to call my
  custom submitWithAjax function??

  $(document).ready(function() {

     $(#my_form).validate({

                 /*Validations - works perfectly!! */

              },

              submitHandler: function(form) {

              /* $(#my_form).submitWithAjax(); - this works but
  introduces recursion */

              /* how to call custom subitWithAjax() ? */

              }

         });
  })

  Thanks!


  1   2   3   4   5   6   7   8   9   10   >