fields( Field::inst( 'first_name' ) ->validator( Validate::notEmpty( ValidateOptions::inst() ->message( 'A first name is required' ) ) ), Field::inst( 'last_name' ) ->validator( Validate::notEmpty( ValidateOptions::inst() ->message( 'A last name is required' ) ) ), Field::inst( 'position' ), Field::inst( 'email' ) ->validator( Validate::email( ValidateOptions::inst() ->message( 'Please enter an e-mail address' ) ) ), Field::inst( 'office' ), Field::inst( 'extn' ), Field::inst( 'age' ) ->validator( Validate::numeric() ) ->setFormatter( Format::ifEmpty(null) ), Field::inst( 'salary' ) ->validator( Validate::numeric() ) ->setFormatter( Format::ifEmpty(null) ), Field::inst( 'start_date' ) ->validator( Validate::dateFormat( 'Y-m-d' ) ) ->getFormatter( Format::dateSqlToFormat( 'Y-m-d' ) ) ->setFormatter( Format::dateFormatToSql('Y-m-d' ) ) ); if ( isset( $_POST['refresh'] ) ) { $editor->where( function ($q) use ($editor) { $ids = explode( ',', $_POST['ids'] ); for ( $i=0 ; $iidPrefix(), '', $ids[$i] ); $q->or_where( 'id', $id ); } } ); } $editor ->process( $_POST ) ->json();