Conditional format of fields

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
rab
Posts: 8
Joined: Wed Apr 27, 2016

27 Apr 2016

Hello, what a graet solution for sharepoint!
I have a small question. I have a very importend field (yes/no field) - I will highlight the field until the field is checked. The field has a own css class (fontsize and bold). Also I have created a additional css style .highlighted which should handle the background color.
In JS editor I have creates a small handler. But it dosn't work. Here is my code: Have you a suggestion?
Thank you
RAB

function entrycompletehandler() {
//var status = fd.field('Title').value();
if (fd.field('Eingang_x0020_vollst_x00e4_ndig').value()) {
fd.field('Eingang_x0020_vollst_x00e4_ndig').control()._el().addClass('highlighted');
}
}
fd.field('Eingang_x0020_vollst_x00e4_ndig').change(function()
{
entrycompletehandler();
});
entrycompletehandler();

User avatar
Dmitry Kozlov
Site Admin
Posts: 1524
Joined: Thu Jun 07, 2012

27 Apr 2016

Hi,

You need to add class to the title of the field:

Code: Select all

function entrycompletehandler() {
	if (fd.field('Eingang_x0020_vollst_x00e4_ndig').value()) {
		fd.field('Eingang_x0020_vollst_x00e4_ndig').title()._el().addClass('highlight');
	} else {
		fd.field('Eingang_x0020_vollst_x00e4_ndig').title()._el().removeClass('highlight');
	}
}
fd.field('Eingang_x0020_vollst_x00e4_ndig').change(function()
{
entrycompletehandler();
});
entrycompletehandler();

rab
Posts: 8
Joined: Wed Apr 27, 2016

27 Apr 2016

Great, it works perfect.

Thank you!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests