Welcome, Guest
Username: Password: Remember me

TOPIC: custom validations !

custom validations ! 16 Sep 2014 10:49 #12632

  • albert
  • albert's Avatar
  • Offline
  • Senior Member
  • Posts: 70
  • Thank you received: 2
  • Karma: 2
Hi,

I would like to use some of this validations on my component
github.com/jzaefferer/jquery-validation/...aster/src/additional

i can do on the form xml required:true, but i do not know how to use for instance the iban of this lilst

can u tell me a little how can i integrate ?
i do not really know where and how i should place the code.

thanks in advance
The administrator has disabled public write access.

custom validations ! 16 Sep 2014 13:02 #12637

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
If you want to create a new validator, it is really simple:

1. create a new rule in :
models/rules/iban.php
Copy paste another rule to give you the example (you can copy email.php it is the easiest)

2. Rename the class, and rename the fork caller (footer of the file)
Note that if you directly create the rule in the fork folder (fork/models/rule/), then I am not sure if it works. Must check that.
Anyway, if you don't create your file in the fork directory (as I tell you), then be carefull when you upgrade your component with fresh generated. That's the only point.
If you encounter problems with that, please up the topic.

3. The regex
in the regex property, write your regex as it appears in JS.

4. In the form set your new "iban" validation


The validator itself is ugly and I would like to change it as an choice option.
If you know nice validator to integrate, I would be amazing. (I did'nt checked news about that for long time)
Coding is now a piece of cake
Last Edit: 16 Sep 2014 13:52 by admin.
The administrator has disabled public write access.
Time to create page: 0.097 seconds

Get Started