[jQuery] Re: Regular Expression validation

2009-08-12 Thread nouky
Thank you I resolved my issue.. On Aug 10, 2:47 pm, Eduardo Pinzon wrote: > jQuery.validator.addMethod("notNumber", function(value, element, param) { >                        var reg = /[0-9]/; >                        if(reg.test(value)){ >                              return false; >          

[jQuery] Re: Regular Expression validation

2009-08-10 Thread Eduardo Pinzon
jQuery.validator.addMethod("notNumber", function(value, element, param) { var reg = /[0-9]/; if(reg.test(value)){ return false; }else{ return true;

[jQuery] Re: Regular Expression validation

2009-08-10 Thread nouky
What I really wanted to do is use the jQuery validator and in the function set a validation that numbers are not allowed in a text input. For example I have this code: $(document).ready(function() { // validate signup form on keyup and submit var validator = $("#signupform").valid

[jQuery] Re: Regular Expression validation

2009-08-10 Thread nouky
I'm not that good with javascript. If the textboxt name is txtname, how do you incorporate it in the code above???

[jQuery] Re: Regular Expression validation

2009-08-09 Thread Karl Swedberg
Hi KeeganWatkins, Here is what the OP (nouky) wrote: I would like to validate a textbox that numbers cannot be entered into the text input That sounds to me like he doesn't want any numbers to be allowed anywhere within the value. I'm interested to hear why you think /[^\d]/g is more ele

[jQuery] Re: Regular Expression validation

2009-08-08 Thread KeeganWatkins
With all due respect, I think karl's solution is somewhat less than elegant, and could be improved by refactoring to: // test for anything but numbers var isValid = /[^\d]/g.test(textareaValString); if (isValid) { // proceed with confidence } else { // note to user: no numbers allowed! }

[jQuery] Re: Regular Expression validation

2009-08-08 Thread Karl Swedberg
On Aug 7, 2009, at 2:53 PM, Michael Lawson wrote: yes, you can grab the value of the textbox and match it against a regular expression var reg = new RegExp("/[a-zA-Z]/"); if(reg.test("string")) { return "valid"; } else { return "not valid"; } Hey Michael, I don't think that regular express

[jQuery] Re: Regular Expression validation

2009-08-07 Thread Michael Lawson
yes, you can grab the value of the textbox and match it against a regular expression var reg = new RegExp("/[a-zA-Z]/"); if(reg.test("string")) { return "valid"; } else { return "not valid"; } like that cheers Michael Lawson Development Lead, Global Solutions, ibm.com Phone: 1-276-206-8393 E-