⚠ 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

hide/show form fields with criteria



musicaways
  • profile picture
  • Member

Posted 12 July 2017 - 12:27 PM

Hello guys.
I would like to modify the fields in a form (show / hide) according to the value selected in a select field.
This process has to be done with two different criteria depending on the selected value.
Return the code I used, can you help me to figure out where I am wrong?
Thanks a lot.

$variable = $this->get_userdata('TIP_P3'); 

  if ($variable == 'TERZI') {
    $crud->field_type('DT_RISP_BANC', 'hidden', 'default_value');
    }

Amit Shah
  • profile picture
  • Member

Posted 13 July 2017 - 05:29 AM

Well you can control the same using Javascript. Write the piece of code in the script to check the value.. and show / hide the fields basis the same.

And you can add the same JS using set_js function from GC.

 

Happy GCing :)