Page 1 of 1

Get value from link-column on display-form

Posted: 25 Sep 2017
by RMIC
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!

Re: Get value from link-column on display-form

Posted: 25 Sep 2017
by Nikita Kurguzov
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();

Re: Get value from link-column on display-form

Posted: 26 Sep 2017
by RMIC
Thank you. That's great!