Page 1 of 1

Hide a field

Posted: 09 Nov 2015
by Eax
Hello,

I have a question about JS :

I try to hide a field when a selection in the other field is made but it doesnt work :

This is my actual code

var Part = fd.field('Typedaffaire').value();
if (Part == 'SEP') {
$('.Partenaires').show();
} else {
$('.Partenaires').hide();
}

Something is wrong ?

Best regards,

Re: Hide a field

Posted: 09 Nov 2015
by rostislav
You need to wrap that in an onchange event handler, like this:

Code: Select all

fd.field('Typedaffaire').change(function(){
 var Part = fd.field('Typedaffaire').value();
 if (Part == 'SEP') {
  $('.Partenaires').show();
 } else {
  $('.Partenaires').hide();
 }
});

Re: Hide a field

Posted: 10 Nov 2015
by Eax
Work for me ! Thanks