Page 1 of 1

Hide/show field on display form

Posted: 31 May 2016
by gianni972
Hello, I have a little question.

I was hiding showing some fields in the edit and new form based on a checkbox.

I have this and its working fine :


function setHide() {

var v = fd.field('NewColumn3').control().value();
if (fd.field('NewColumn3').value()) {
$('.Abstellmaßnahmen').show(); // Enable
} else {
$('.Abstellmaßnahmen').hide(); // Disable
}
}

// Subscribe on status change
fd.field('NewColumn3').control().change(function () {
setHide();
});

// Initialize
setHide();

----------------------------------

My problem is that when i try to make it on the display form, i cannot find the way to make it with the same method.

here an example :


function setShow() {
var v = fd.field('NewColumn3').control().value();
if (v == 'Yes' || v == 'No') {
$('.Abstellmaßnahmen').show(); // Enable
} else {
$('.Abstellmaßnahmen').hide(); // Disable
}
}

// Subscribe on status change
fd.field('NewColumn3').control().change(function () {
setShow();
});

// Initialize
setShow();



Can you tell me what i missed, please



Gianni

Re: Hide/show field on display form

Posted: 31 May 2016
by rostislav
Use:

Code: Select all

fd.field('NewColumn3').control()._el().text()
to get the value of the checkbox

Re: Hide/show field on display form

Posted: 06 Jun 2016
by gianni972
Thanks that was the issue.


Thanks for the support

Re: Hide/show field on display form

Posted: 15 Sep 2016
by TKleinfeld
may i ask how the final form for the display form have to look like now?

just interested. and i'm very new to JS sry. ;)

thx and regards,

TK