Issue with date field
Issue with date field
In my application everything was working fine till few days ago(sounds strange i know) but now the 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://s2.postimg.org/vkzq6d0bd/Chrome_create.png
Same with update field.Everything is populated except date field
http://s28.postimg.org/6i80d3tfx/Chrome_Update.png
In mozilla firefox Date widget is altogether not displayed
http://s21.postimg.org/z68ey7rrr/Mozilla_Create.png
But yes date is displayed when trying to update a record but without date widget
http://s10.postimg.org/5cdkea6mx/Mozilla_Update.png
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 side 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();
Answers
@allan ?????