Hide/show field on display form

rss

Posted by gianni972 - May 31 ’16 at 07:03

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

 

  • rostislav
    rostislav
    Moderator
    Member for: 6 years 8 months 14 days
    #1 by rostislav May 31 ’16 at 07:30

    Use:

    fd.field('NewColumn3').control()._el().text()

    to get the value of the checkbox

  • gianni972
    Member
    Member for: 5 years 8 months 1 day
    #2 by gianni972 Jun 6 ’16 at 06:20

    Thanks that was the issue.

     

    Thanks for the support

  • TKleinfeld
    Member
    Member for: 5 years 4 months 8 days
    #3 by TKleinfeld Sep 15 ’16 at 04:22

    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

Displaying 1 to 3 of 3 messages