Date field behaves little strange and gives different behaviour in Firefox and Chrome
In Chrome this is what date field looks like when i try to create a new record even though i enter date through date widget i still get error message http://ift.tt/1vG8cbG
Same with update field.Everything is populated except date field http://ift.tt/1DhEcAz
In mozilla firefox Date widget is altogether not displayed http://ift.tt/1vG8dMO
But yes date is displayed when trying to update a record but without date widget http://ift.tt/1DhEcQN
Here is my js code
var editor = new $.fn.dataTable.Editor( {
"ajax": "php/table.JKBINSR.php",
"table": "#JKBINSR",
"fields": [
{
"label": "ACCOUNT NO",
"name": "accntno",
"type": "text"
},
{
"label": "ACCOUNT TITLE",
"name": "accnttitle",
"type": "text"
},
{
"label": "ALIAS ACCOUNT NO",
"name": "alias",
"type": "select",
"ipOpts": [
{
"label": "CC",
"value": "CC"
},
{
"label": "CD",
"value": "CD"
},
{
"label": "OTL",
"value": "OTL"
},
{
"label": "CAR",
"value": "CAR"
},
{
"label": "OTHR",
"value": "OTHR"
}
]
},
{
"label": "DATE OF INSURANCE",
"name": "doi",
"type": "date",
"dateFormat": "mm-dd-y",
"dateImage": "images\/calender.png"
},
{
"label": "DATE OF EXPIRY",
"name": "doe",
"type": "date",
"dateFormat": "mm-dd-y",
"dateImage": "images\/calender.png"
},
{
"label": "AMOUNT",
"name": "amount",
"type": "text"
},
{
"label": "POLICY NO",
"name": "POLNO",
"type": "text"
},
{
"label": "REMARKS",
"name": "remark",
"type": "text"
}
]
} );
and the server code
Editor::inst( $db, 'JKBINSR', 'id' )
->fields(
Field::inst( 'accntno' )
->validator( 'Validate::minMaxLen', array( 'empty'=>false, 'min'=>16, 'max'=>16 ) ),
Field::inst( 'accnttitle' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'alias' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'doi' )
->validator( 'Validate::dateFormat', array( 'empty'=>false, 'format'=>'m-d-y' ) )
->getFormatter( 'Format::date_sql_to_format', 'm-d-y' )
->setFormatter( 'Format::date_format_to_sql', 'm-d-y' ),
Field::inst( 'doe' )
->validator( 'Validate::dateFormat', array( 'empty'=>false, 'format'=>'m-d-y' ) )
->getFormatter( 'Format::date_sql_to_format', 'm-d-y' )
->setFormatter( 'Format::date_format_to_sql', 'm-d-y' ),
Field::inst( 'amount' )
->validator( 'Validate::notEmpty' ),
Field::inst( 'POLNO' ),
Field::inst( 'remark' )
)
->process( $_POST )
->json();
Aucun commentaire:
Enregistrer un commentaire