Get value from link-column on display-form

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
RMIC
Posts: 96
Joined: Sun May 10, 2015

25 Sep 2017

Hello,

I want to show or hide a picture with a column value (URL) on a display form.

The column is a hyperlink / image. If a URL is included, the image should be displayed. If no URL is included, the image should be hidden.

On the edit form it works, but not on the display form.


My Code:
var url = fd.field('Link-Column').value();
if (url == '')
{
$('.picture').hide();
}

so it does not go:
var url = fd.field('Link-Column').value()[0];
if (url == '')
{
$('.picture').hide();
}


What am I doing wrong?
Many Thanks!

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

25 Sep 2017

Hello, RMIC!
The problem is that Display Form doesn't work quite like the other Forms. Since the Fields are automatically set to Readonly on it and can't be changed, you need to use different code to get the actual value from the Field.

Try this code, for example, it should work for the Text field on the Display Form:

Code: Select all

fd.field("Link-Column").control()._el().text();
Cheers

RMIC
Posts: 96
Joined: Sun May 10, 2015

26 Sep 2017

Thank you. That's great!

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests