Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

custom validations ! 16 Sep 2014 10:49 #12632

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 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

Please Log in or Create an account to join the conversation.

custom validations ! 16 Sep 2014 13:02 #12637

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.053 seconds

  Excellent Tool ! This tool will save you a lot of time writing the same old structure. I've used others but this is really nice for a quick start. Makes a 3 hour task a 15 minute one. Thanks for this extension
dickrundell (JED)
         

Get Started