⚠ 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

Adding a new field depending of other field



AndresSEGC

AndresSEGC
  • profile picture
  • Member

Posted 28 September 2020 - 15:55 PM

Hello,

 

i need to add a writable field only when the user select "yes", otherwise that field need to be hidden. 

 

How can i do that?

 

I tried JS, selecting the field and showing the other field, but didnt work.

I tried with CodeIgniter code, calling a function in a CallbackAfterInsert, but nothing...

$crud->callbackAfterInsert(function ($stateParameters) {
		
			if($stateParameters->data['is_group'] == 1){
			    $this->grupo_empresas($stateParameters->data['client_id']);
			    return $stateParameters;			
		
			}else{
			    return $stateParameters;				
			}
			
		});