aditional verfication before posting

aditional verfication before posting

vinod_ccvvinod_ccv Posts: 75Questions: 0Answers: 0
edited February 2013 in Editor
Hi Allan,
This is the php part of my project and it works fine
include( "lib/DataTables.php" );
$editor = Editor::inst( $db, 'class_timings' )
->fields( Field::inst( 'id' )->set( false ),
Field::inst( 'batch_id' )->validator( 'Validate::required' ),
Field::inst( 'start_time' )->validator( 'Validate::required' ),
Field::inst( 'end_time' )->validator( 'Validate::required' ));
$out = $editor
But I would like to do some database verification before posting the values. For example, I have to make sure that the post[start_time] should not be between start time and end time of any record available in the db. if any of record matches i have to stop execution and give message .
How can i accomplish that.


  • allanallan Posts: 55,883Questions: 1Answers: 8,835 Site admin
    Use the validator method as a closure function. It gets passed three parameters:

    1. The value to check
    2. The data for the row
    3. Options (with is specific to each case)

    So you could have a function that checks for your start time requirements and gives an error if it does not match. Have a look at Validate.php to see how the built in Validation methods work. You could also add your own if you don't want to use a closure.

This discussion has been closed.