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.091 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started