[jQuery] Re: [validate] - Validation by regular expression

2008-12-08 Thread Jörn Zaefferer
First, that should be: addMethod("buga", function(value, element, regex) { var expression = new RegExp(regex, "g"); return (value.replace(expression,"").length==0); } Second, just the same as your initial draft: someElement: { required: true, buga: "[a-z]" } But that wasn't the point, rat

[jQuery] Re: [validate] - Validation by regular expression

2008-12-08 Thread skidmarek
For example: addMethod("buga", function(value, regex) { var expression = new RegExp(regex, "g"); return (value.replace(expression,"").length==0); } how then would I call buga from the rules section of my form definition? On Dec 8, 11:49 am, "Jörn Zaefferer" <[EMAIL PROTECTED]> wrote: > I'm

[jQuery] Re: [validate] - Validation by regular expression

2008-12-08 Thread Jörn Zaefferer
I'm not following your question. Could you give me an example? Jörn On Mon, Dec 8, 2008 at 5:24 PM, skidmarek <[EMAIL PROTECTED]> wrote: > > I've changed my code to use addMethod, but I'm not terribly happy with > the way it's working out. Would it be possible to use addMethod to > create a vali

[jQuery] Re: [validate] - Validation by regular expression

2008-12-08 Thread skidmarek
I've changed my code to use addMethod, but I'm not terribly happy with the way it's working out. Would it be possible to use addMethod to create a validation function to which I could pass a 2nd parameter being the regular expression. If so, what would the rules: entry look like? On Dec 5, 5:14

[jQuery] Re: [validate] - Validation by regular expression

2008-12-05 Thread Jörn Zaefferer
You can safely remove the first modification, thats not necessary. Its used for required only to move the method to the front (which is actually a bad workaround). Anyway: I've commented on regex-methods here: http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage Please