Get value from link-column on display-form
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!
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!
- Nikita Kurguzov
- Posts: 889
- Joined: Mon Jul 03, 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:
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
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests