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

TOPIC:

Validation Engine 15 Sep 2013 15:16 #11093

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
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 ?

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

Validation Engine 19 Sep 2013 09:28 #11110

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
anybody ?

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

Validation Engine 19 Sep 2013 09:35 #11112

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?

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

Validation Engine 19 Sep 2013 09:38 #11113

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
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 ?

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

Validation Engine 19 Sep 2013 09:41 #11114

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

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

Last edit: by Tomaselli. Reason: example added

Validation Engine 19 Sep 2013 09:53 #11115

  • VeCrea
  • VeCrea's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
Thanks, will try this again. K+

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

Validation Engine 19 Sep 2013 10:25 #11116

"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.

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

Validation Engine 19 Sep 2013 11:38 #11117

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

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

Validation Engine 19 Sep 2013 11:44 #11118

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

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

  • Page:
  • 1
Time to create page: 0.077 seconds

I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started