⚠ 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 forum is read-only and soon will be archived. ⚠

callback_edit_field resulting into showing fields on read page

callback_edit_field field_type-hidden

  • Please log in to reply
1 reply to this topic

#1 Nitin Thokare

Nitin Thokare


  • Members
  • PipPip
  • 25 posts

Posted 31 May 2014 - 10:21 AM

Without using callback_edit_field, when I read (view) the data, the page displays as shown in first attached file img1.png (with no empty text boxes at the end)...


Now I'm trying to hide password fields on read page and also want to make those fields empty on edit page, with following lines of code:


if ($crud->getState() == 'read') {
    $crud->field_type('Password', 'hidden');
    $crud->field_type('ConfPassword', 'hidden');

with this code, when I try to read (view) data, it's displaying empty password fields on that page as shown in second attached image (img2.png)...



The full code is as below:


function view_user(){       $this->check_logged_in();

   $crud = new grocery_CRUD();
   /*set theme and table*/


   /*column in displayed table and fields to view/add/edit */
   $crud->display_as('FirstName','First Name');
   $crud->display_as('ConfPassword','Confirm Password');

   $crud->field_type('Gender', 'enum',array('Male','Female'));
   $crud->field_type("Address", "text");
   $crud->field_type("Password", "password");
   $crud->field_type("ConfPassword", "password");

   /*required field in add/edit*/


   /*form validation rules*/

   if ($crud->getState() == 'read') {
       $crud->field_type('Password', 'hidden');
       $crud->field_type('ConfPassword', 'hidden');

   $output = $crud->render();


function set_password_input_to_empty($post_array, $primary_key=null){
   return "<input type='password' name='Password' value='' />";

function set_confpassword_input_to_empty($post_array, $primary_key=null){
   return "<input type='password' name='ConfPassword' value='' />";

function unset_verification($post_array) {
   $key = config_item('encryption_key');
   $post_array['Password'] = hash_hmac('md5', $post_array['Password'], $key);
   return $post_array;

Can anybody tell me what's the problem due to which empty password fields are being displayed on read page even though they are hidden when getState()=='read' ?



Attached Thumbnails

  • Img1.png
  • Img2.png

#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts

Posted 31 May 2014 - 07:41 PM

hi there


Refer to the link below .. u will get solution


Also tagged with one or more of these keywords: callback_edit_field, field_type-hidden

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users