2009-11-01

Kohana extended form rules

Important! All Kohana-related posts are now at http://kohana.lillem4n.se.

New version available here, a post about this issue is located here.

This is a module with rules you'd like when validating forms in kohana. It is the same concept as the valid::-rules.

For example:
$post->add_rules('some_field', 'required', 'digit', 'formrules::positive');


This will require "some_field" to be a digit (whole number) above zero.

For now, positive is actually the only rule in this module. So it is more like the foundation of a module. :) More rules will follow.

Hashes: #kohana form rules module #kohana module #kohana #form validation #php

2 comments:

  1. Excellent! Its should be named formrules::positive :)

    ReplyDelete
  2. Absolutely. aboveZero() is now positive()

    Thanks. :)

    ReplyDelete