Skip to content

Commit 7c6db53

Browse files
author
David Luecke
committed
Merge pull request daffl#20 from Perlover/feature/validate-opts
Documentation of 'validate' subscriber was corrected and has been added the example of validate subscriber
2 parents 43b9c40 + dec8e31 commit 7c6db53

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

src/dform.extensions.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -550,10 +550,49 @@
550550
* subscriber: validate
551551
*
552552
* Adds support for the jQuery validation rulesets.
553+
* For types: <text>, <password>, <textarea>, <radio>, <checkbox> sets up rules through rules("add", rules) for validation plugin
554+
* For type <form> sets up as options object for validate method of validation plugin
555+
* For rules of types <checkboxes> and <radiobuttons> you should use this subscriber for type <form> (to see example below)
553556
*
554-
* Parameters:
555-
* options - Options as specified in the rules parameter
556-
* type - The type of the *this* element
557+
* Example:
558+
* validations for radiobuttons group and for text field:
559+
*
560+
* (start code)
561+
* {
562+
* "type" : "form",
563+
* "validate" :
564+
* {
565+
* "rules" :
566+
* {
567+
* "radio_group": "required"
568+
* }
569+
* },
570+
* "elements" :
571+
* [
572+
* {
573+
* "type" : "radiobuttons",
574+
* "caption" : "You should choose from here"
575+
* "name" : "radio_group",
576+
* "options" :
577+
* {
578+
* "Y" : "Yes",
579+
* "N" : "No"
580+
* }
581+
*
582+
* },
583+
* {
584+
* "type" : "text",
585+
* "name" : "url",
586+
* "validate" :
587+
* {
588+
* "required" : true,
589+
* "url" : true
590+
* }
591+
* }
592+
*
593+
* ]
594+
* }
595+
* (end)
557596
*/
558597
"validate" : function(options, type)
559598
{

0 commit comments

Comments
 (0)