Welcome, Guest
Username: Password: Remember me

TOPIC: Validation Engine

Validation Engine 15 Sep 2013 15:16 #11093

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
This thing is killing me. I hate validation engine, but sure because i can't understand how it works if you want to be able to apply custom rules like past[NOW or a date]... I should just modify the xml file, shouldn't i ?
And what about : if some boolean is set to true, then one field becomes required. jQuery or ValidationEngine rule ?
Any clues or experience ?
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 09:28 #11110

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
anybody ?
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 09:35 #11112

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Hi VeCrea,
I don't have a lot of experience on the jQuery validationengine plugin, I just modified it a bit to work with the bootstrap tabs, this is my experience on it.
I didn't understand clearly what you are trying to do, could you please do a simple example?
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 09:38 #11113

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Checkbox : vehicule used or not ?
If checkbox is checked, then licence plate becomes required. If unchecked, licence plates should be empty and not required

Add a class in jQuery (validate[required]), or a specific rule in Validation Engine ?
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 09:41 #11114

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
reading the jquery validationengine API I used some conditional validation rule using:

validate[condRequired[ID_OF_THE_FIELD_REQUIRED]]



example from GITHUB:
<input value="" type="text" name="creditcard" id="creditcard" />
<input class="validate[condRequired[creditcard]]" type="text" id="ccv" name="ccv"/>


p.s.
I also updated the validationengine to the last release
Last Edit: 19 Sep 2013 09:44 by Tomaselli. Reason: example added
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 09:53 #11115

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Thanks, will try this again. K+
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 10:25 #11116

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
"again"?!?! so you tried it and didn't work? it perfectly worked to me, I added it in the XML, and it worked. in other situations I had to attach again the validation engine to the form, but I don't remember why, I think I added dynamically some fields, not sure.
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 11:38 #11117

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
When you want to create a custom regex.

Create a rule file in models/rules

for example : creditcard.php

Copy email.php as basis of file.
1. Rename php class
2. Rename $handler property
3. Write your regex in $regex property.

Then from css, you call it through class name :
validate[custom[creditcard]]
Coding is now a piece of cake
The administrator has disabled public write access.

Validation Engine 19 Sep 2013 11:44 #11118

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Possibly you do not have 'email' rule, you can copy another rule...
... Or also, more simple you can create a custom validator in Cook. Handler is the name of the rule.
After regeneration. Your custom rule will appear in the model/rules/ directory.

Also in the XML JForm define.
validate="creditcard"
Doing this way, your regex is also automatically applied in php to prevent injections.
(One Regex only for both JS and PHP)
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.083 seconds

Get Started