Showing posts with label form validation. Show all posts
Showing posts with label form validation. Show all posts

2010-01-06

New form rules

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

The module formrules is updated with two new methods: futureTimeStamp() and pastTimeStamp().

This can simply be passed in a form validation to check a string for both validation to strtotime() and so it is either in the future or in the past. Example:

$post->add_rules('someFormField', 'formrules::futureTimeStamp')


This is an update to this post.

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

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