⚠ 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

callback_field can only be used once ?



archerwisdom

archerwisdom
  • profile picture
  • Member

Posted 17 November 2013 - 16:40 PM

Hi,

 

I plan to set a session using callback_field.And after that want to set the field as hidden.

 

My code is like this:

$crud->callback_field('function_time',array($this,'set_functiontime_session_callback'));
$crud->field_type('function_time', 'hidden');

When I view the page source, there is no hidden field.It seems the callback_field only executed once for one particular field.

 

Here is my callback function: 

function set_functiontime_session_callback($value = '', $primary_key = null){        
   $this->session->set_userdata('fv_function_time',$value);
}

Have I do it wrongly?

 


edramirez

edramirez
  • profile picture
  • Member

Posted 19 November 2013 - 16:57 PM

If you check the documentation, you will notice that the callback_field function is to provide an alternate add and edit functionality to a particular field. Think about this, add and edit functionality apply to visible fields. Setting such a field to hidden doesn't make sense if you want add and edit functionality. In your case, it didn't become invisible.

 

If you want the field to become invisible, don't assign a callback_field function to that particular field.

 

Can you handle that?

 

Hope this helps...

 

Regards,

 

Ed

 

P.S. Don't forget to click the Like button... B)


Robert

Robert
  • profile picture
  • Member

Posted 20 November 2013 - 14:22 PM

Jest use in view this :

<style type="text/css">
#function_time_field_box	{
    display:none;
}
</style>

you can use firefox to find the div name. I have used this a few times to. I think the div will be function_time_field_box but not sure