Hide/show field on display form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
gianni972
Posts: 7
Joined: Wed May 18, 2016

31 May 2016

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

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

31 May 2016

Use:

Code: Select all

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

gianni972
Posts: 7
Joined: Wed May 18, 2016

06 Jun 2016

Thanks that was the issue.


Thanks for the support

TKleinfeld
Posts: 5
Joined: Sun Sep 11, 2016

15 Sep 2016

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 4 guests