HighDots Forums  

(validate) Customising bassistance validation plugin

jQuery jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


Discuss (validate) Customising bassistance validation plugin in the jQuery forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Iwan Vosloo
 
Posts: n/a

Default (validate) Customising bassistance validation plugin - 11-07-2009 , 12:21 AM






Hello,

We are trying to use the validation plugin with HTML that's been
generated for us. There are a couple of things we'd like to customise
if we can for the plugin to work with this HTML.

One of them is that the code uses some HTML5 conventions - like how to
specify when an input is required:

Usually you'll have something like:
<input type="text" class="required">

In our HTML, we'd have:
<input type="text" required>

Is there a way to customise/configure the validation plugin to
recognise the latter?

Thanks
- Iwan

Reply With Quote
  #2  
Old   
Jörn Zaefferer
 
Posts: n/a

Default Re: [jQuery] (validate) Customising bassistance validation plugin - 11-07-2009 , 08:28 AM






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.

Jörn

On Sat, Nov 7, 2009 at 6:21 AM, Iwan Vosloo <iwan (AT) reahl (DOT) org> wrote:

Quote:
Hello,

We are trying to use the validation plugin with HTML that's been
generated for us. There are a couple of things we'd like to customise
if we can for the plugin to work with this HTML.

One of them is that the code uses some HTML5 conventions - like how to
specify when an input is required:

Usually you'll have something like:
input type="text" class="required"

In our HTML, we'd have:
input type="text" required

Is there a way to customise/configure the validation plugin to
recognise the latter?

Thanks
- Iwan

Reply With Quote
  #3  
Old   
Iwan Vosloo
 
Posts: n/a

Default Re: (validate) Customising bassistance validation plugin - 11-09-2009 , 07:14 AM



Hi Jörn,

On Nov 7, 3:28*pm, Jörn Zaefferer <joern.zaeffe... (AT) googlemail (DOT) com>
wrote:
Quote:
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

Reply With Quote
  #4  
Old   
Iwan Vosloo
 
Posts: n/a

Default Re: (validate) Customising bassistance validation plugin - 11-09-2009 , 08:58 AM



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... (AT) reahl (DOT) org> wrote:
Quote:
Hi Jörn,

On Nov 7, 3:28*pm, Jörn Zaefferer <joern.zaeffe... (AT) googlemail (DOT) 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

Reply With Quote
  #5  
Old   
Iwan Vosloo
 
Posts: n/a

Default Re: (validate) Customising bassistance validation plugin - 11-09-2009 , 01:46 PM



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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.