aditional verfication before posting
aditional verfication before posting
Hi Allan,
This is the php part of my project and it works fine
[quote]
include( "lib/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
$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
->process($_POST)
->data();
[/quote]
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.
This is the php part of my project and it works fine
[quote]
include( "lib/DataTables.php" );
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;
$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
->process($_POST)
->data();
[/quote]
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.
This discussion has been closed.
Replies
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.
Allan