⚠ 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

Show/Hide field from Dropdown



Julio

Julio
  • profile picture
  • Member

Posted 20 November 2017 - 15:16 PM

Hi everyone,

 

I have a dropdown list field that, when selecting item 1, must hide the X field and display the Y one, selecting item 2 should reverse the action.
 
The content loaded in the list is in a table and there is a field in the item that defines its behavior.
 
I believe the solution is to use JS, but could someone please help me with an example and where to enter the code?
 
 
Thanks.
 
 
Julio.

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 21 November 2017 - 04:30 AM

Hi Julio,

 

Well you can refer to the following post to understand the same...

http://www.amitsgarage.com/knowledge-base/grocerycrud/take-control-of-the-add-edit-page/

 

There is a simple way around. Each field have have a name lets say contactFirstName. Each div container have a class assigned to the same..

contactFirstName_form_group

The <fieldname>_form_group is a class assigned to the div container of the field.

So - its simple - u just need to pick up the class name - show / hide.. do whatever you like.

 

Happy GCing :)


Julio

Julio
  • profile picture
  • Member

Posted 21 November 2017 - 21:33 PM

Hi Amit,

 

Sorry my lack of knowledge, but would you have an example code?

 

How can I get from dropdown a field value related the list item that's set in the table?

 

Thanks,

 

Julio.