conditional show / hide

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
User avatar
baudwalker
Veteran Member
Posts: 98
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

conditional show / hide

Post by baudwalker » 2018-12-08 09:10

I am looking for assistance in the following.

When creating or editing a record I would like to hide certain fields after a particular selection
EG
among others there are the following fields
varchar - multi select field 'position', Required selection are 'secretary' and 'captain'
varchar - 'dates'
varchar - 'time'
text - 'comments'

What is required is if 'secretary' is selected hide 'dates' and 'time' and show all other fields
if captain is selected hide 'comments' and show all other fields

pseudo code.

if position = secretary then hide 'dates' and 'time' else hide 'comments'

thank you in anticipation

Barry

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 114
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: conditional show / hide

Post by jsetzer » 2018-12-08 11:57

Hi Barry,

have a look here. Is this what you need?

https://forums.appgini.com/phpbb/viewto ... 8934#p8550

Feel free to contact me in case you need support.

Regards,
Jan

https://www.bizzworxx.com

User avatar
baudwalker
Veteran Member
Posts: 98
Joined: 2015-02-03 08:08
Location: Bellingen NSW Australia

Re: conditional show / hide

Post by baudwalker » 2018-12-10 06:36

Thank you Jan,
I will see if I can, hopefully, adapt the code to my requirements,

Barry

Alisson
Posts: 21
Joined: 2017-02-25 20:32

Re: conditional show / hide

Post by Alisson » 2018-12-16 01:34

Code: Select all

jQuery(function(){
  jQuery('#position-container').on('change', function() {
    if(jQuery('#department-container').val() == 'secretary'){
      $j('#dates').parents('.form-group').hide();
      $j('#time').parents('.form-group').hide();
    }
     else {
      $j('#comments').parents('.form-group').hide();
      };      
  });
});

Post Reply