⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Why hidden date input doesn't save nothing?



jpmayoral
  • profile picture
  • Member

Posted 05 September 2012 - 16:11 PM

Hi there! I'm trying to save the row updated date and I've this in the code:


$now = date('d/m/Y h:m:s');

$crud->change_field_type('updated_at','hidden',$now);

In html I have this:

<input id="field-updated_at" type="hidden" name="updated_at" value="05/09/2012 01:09:09">

but when I send my data it doesn't save the date... any help???? thanks!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 05 September 2012 - 19:50 PM

You have to change the

$now = date('d/m/Y h:m:s');

to:

$now = date('Y-m-d H:i:s');


For now grocery CRUD doesn't accept multiple field types. For example in your situation the field type is both "hidden" and "date". So the hidden field has to be in a SQL format.

Cheers
Johnny

jpmayoral
  • profile picture
  • Member

Posted 05 September 2012 - 20:02 PM

Thanks Johnny for the quick reply!!! It's worked great! :D