Hi,
Thanks for the jQuery plugin module. Great idea.
I'm new at Drupal and jQuery...could someone post a usage example to enable form field validation in a custom module, please?
Thanks, mitz
Hi,
Thanks for the jQuery plugin module. Great idea.
I'm new at Drupal and jQuery...could someone post a usage example to enable form field validation in a custom module, please?
Thanks, mitz
Comments
Comment #1
mitz commentedPS I'm assumed, probably incorrectly, that the 1.1 from the version number on this request is for 1.1.1 version of jquery.validate.min.js. Anyway, I just downloaded jquery_update and jquery_plugin from the Drupal site yesterday (22 June 2008).
Comment #2
kevinquillen commentedWebforms module makes use of this, by the way. (If youre so inclined to use it)
Comment #3
mfbHere's a straight-forward usage; just loading your validation rules from a javascript file:
Put the rules in the module's javascript file:
There are many more advanced usage possibilities, for example using the metadata plugin to store your validation rules as HTML attributes; etc.
Comment #4
mitz commentedThanks, mfb. I'll give it a try.
Also, thanks gh0st25 for the info.
Comment #5
mfbPlease re-open if you have other questions.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
LEternity commentedI'd like to know whether I could use this with the editablefields module. If so, would you be able to provide a simple example of how to implement this? Thank you!
Comment #8
bala.d commentedUse the js file as follows:
$(function() {
$("#user-register").validate({
rules: {
'name': {
minlength: 5,
required: true
},
'mail': {
minlength: 10,
required: true
},
}
});
});
Be careful. as simple typo error wont give results...
Thanks to mfb...
Comment #9
umesh_chaudhari commentedhi where do i need to put this code
Comment #10
hiramanpatil