⚠ 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

field_type



dblanco
  • profile picture
  • Member

Posted 14 December 2012 - 21:40 PM

I try to create a hidden field with this configuration:


$this->grocery_crud->edit_fields('nombre','apellido', 'email', 'usuario', 'habilitado', 'usuario_old', 'email_old');
$this->grocery_crud->field_type('usuario_old', 'hidden', 'usuarioviejo');
$this->grocery_crud->field_type('email_old', 'hidden', 'emailold');


I get the following error:


[b] A PHP Error was encountered[/b]

Severity: Notice
Message: Undefined property: stdClass::$extras
Filename: libraries/grocery_crud.php
Line Number: 2133

Using these versions:
Codeigniter 2.0
Grocery Crud 1.3

For the versions listed in the documentation, it should work. Is there a problem?

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

Posted 15 December 2012 - 10:08 AM

[member='dblanco'] perhaps this is a small version bug of Codeigntier

Why you are not upgrading the Codeigniter to the latest version 2.1.3 ? Since 2.0.x they are lot of bug fixes and it is really worth it to upgrade your codeigniter to version 2.1. The upgrade of Codeigniter is really simple:
[b]1st. step[/b]: Replace your old system folder with the new system folder of Codeigniter version 2.1.3
[b]2nd step:[/b] Just navigate your webpages into your browser to check if everything is working fine for you.
[b]3rd step: [/b]That's it!

Oh! And you will also realize some speed changes as they also optimized a lot the code of Codeigniter since 2.0 :)

dblanco
  • profile picture
  • Member

Posted 15 December 2012 - 17:52 PM

Using these versions:
Codeigniter 2.1.3.
Grocery Crud 1.3

Gives the same error in php!

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

Posted 15 December 2012 - 18:03 PM

[member='dblanco'] sorry, blame on me :rolleyes: . You are right. This was a bug from grocery CRUD version 1.3 that was fixed. You can also upgrade the version of grocery CRUD to the latest one (1.3.3) and make sure that this will work for you.
Don't worry from version 1.3 to 1.3.3 I haven't rename any function so you will not have any problem with that. Also the good part is that grocery CRUD 1.3.3 is much smaller from 1.3 (half size), so it will be much faster for you.

To upgrade grocery CRUD to the latest version always make sure that you include:

- assets
- application/config/grocery_crud.php
- application/libraries/grocery_crud.php
- application/models/grocery_crud_model.php

I really think it is better to just update the library than try to investigate to an old bug of version 1.3.

Cheers
Johnny

dblanco
  • profile picture
  • Member

Posted 15 December 2012 - 18:12 PM

Sorry but it is giving error with version 1.3.3.

I forgot to mention that hidden fields are not in the database.

So what is giving error is:

protected function get_hidden_input($field_info,$value)
{
if($field_info->extras !== null && $field_info->extras != false)
$value = $field_info->extras;
$input = "<input id='field-{$field_info->name}' type='hidden' name='{$field_info->name}' value='$value' />";
return $input;
}

Because the extras variable of field is not defined

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

Posted 16 December 2012 - 09:45 AM

Ok I can't reproduce the error but I think I fixed this bug. So as a conclusion the problem was because the value wasn't in the database.

So this was a bug of grocery CRUD and I have fixed it. You can see the fix at: https://github.com/s...af58d0ad0cce3c4

Hope it works for you and thanks for the patience to give me a bug report.

Regards
Johnny

dblanco
  • profile picture
  • Member

Posted 16 December 2012 - 16:40 PM

Thanks Johnny