⚠ 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

problem with the form_validation->set_message



aaries

aaries
  • profile picture
  • Member

Posted 06 January 2012 - 04:31 AM

Hi, i have this code for example


function cliente()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('cliente');
$crud->set_subject('Cliente');
$crud->required_fields('nombre','rut');
$crud->set_rules('nombre','Nombre','callback_nombre_check');

$crud->callback_column('Accion',array($this,'goSucursal'));
$crud->columns('nombre','rut','Accion');
$crud->fields('nombre','rut');
$output = $crud->render();
$this->_example_output($output);
}


with this funcion of validation


function nombre_check($str)
{
if( $str== 'test')
{
$this->form_validation->set_message('nombre_check', $str.' no es un nombre valido');
return FALSE;
}
else
{
return TRUE;
}
return $str;
}


but the message doesn’t appears, on the contrary appears this message “Unable to access an error message corresponding to your field name.”
I use other version of grocery crud and that's works, but i need new methods to bring the latest version of grocery.

Help me Please!!

regards!

aaries

aaries
  • profile picture
  • Member

Posted 06 January 2012 - 05:02 AM

I fix the problem, but that code don't recognize de error required fields, in case i try to save a blank item.

where or what i could change the language a required fields of grocery?

help plz

web-johnny

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

Posted 06 January 2012 - 07:22 AM

[quote name='aaries' timestamp='1325824293' post='228']
Hi, i have this code for example


function cliente()
{
$crud = new grocery_CRUD();
$crud->set_theme('flexigrid');
$crud->set_table('cliente');
$crud->set_subject('Cliente');
$crud->required_fields('nombre','rut');
$crud->set_rules('nombre','Nombre','callback_nombre_check');

$crud->callback_column('Accion',array($this,'goSucursal'));
$crud->columns('nombre','rut','Accion');
$crud->fields('nombre','rut');
$output = $crud->render();
$this->_example_output($output);
}


with this funcion of validation


function nombre_check($str)
{
if( $str== 'test')
{
$this->form_validation->set_message('nombre_check', $str.' no es un nombre valido');
return FALSE;
}
else
{
return TRUE;
}
return $str;
}


but the message doesn’t appears, on the contrary appears this message “Unable to access an error message corresponding to your field name.”
I use other version of grocery crud and that's works, but i need new methods to bring the latest version of grocery.

Help me Please!!

regards!
[/quote]

Yes this is a BUG of 1.1.6 . I fixed it for the newer version. You can add this line of code and propably it will solve the problem. https://github.com/scoumbourdis/grocery-crud/commit/54d3b650a2d0a8261b5776d4fc24ddc1759c1c2e

aaries

aaries
  • profile picture
  • Member

Posted 06 January 2012 - 15:57 PM

I do it!, but i need to set with other value de message of required fields, where i could change that?

regards!

aaries

aaries
  • profile picture
  • Member

Posted 06 January 2012 - 16:41 PM

forget it! i found the script with the language in codeigniter system,

Thank's!