Not Null date, but I need to pass the empty value.

QuestionsNot Null date, but I need to pass the empty value.
Aidas asked 3 years ago

I have date field with date range picker:

$col = array();
$col[“title”] = “Date”;
$col[“name”] = “invdate”;
$col[“width”] = “25”;
$col[“formatter”] = “date”; // makes field required???
$col[“formatoptions”] = array(“srcformat”=>’Y-m-d’,”newformat”=>’Y-m-d’);
$col[“editable”] = true; // this column is editable
$col[“sortable”] = true;
$col[“searchoptions”][“opts”] = array(“initialText”=>”PaieŇ°kos periodas”);
$col[“editrules”] = array(“required”=>false, “edithidden”=>true);
$cols[] = $col;

When adding new row I got error message when Date field has no value:
Couldn’t execute query. Column ‘invdate’ cannot be null – INSERT INTO invheader (`client_id`,`seller`,`buyer`,`invoice_number`,`invdate`,`due_date`,`amount`,`tax`,`total`,`sell_purch`,`status`,`note`) VALUES (‘1′,”,”,”,NULL,NULL,”,”,”,’ ‘,’ ‘,”)

$col[“formatter”] = “date”;

line makes field required, because if I comment this line, no error message with empty Date field. But no date picker on the field. If I edit row value and delete date from this field, no error message.

How to fix it?

1 Answers
Abu Ghufran Staff answered 3 years ago


I’m unable to generate this issue here. I’ve sent you latest build to test with.

If you still face this issue with new build as well, please send me your grid code and database dump to generate exact case here.

Abu Ghufran - Dev Team
Grid 4 PHP Framework
Your Answer

13 + 18 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.

How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?