Accessing Display Form values with Javascript

Hi, is it possible to get or set field values in the Display form in a similar way to how you would manipulate them in the New or Edit form? I try to read the field values using

var fieldval = fd.field(‘Myfield’).value;

however the console returns a null value, is it possible to get or set/change these values?

Dear @abolam,
It is possible to access and even change displayed values with the following JS:

var fieldval = fd.field('Title').$el.innerText;
fd.field('Title').$el.innerText = 'Test';

But, of course, you can’t save these new values to SharePoint List, they are purely for cosmetic purpose. If you want to change them for good you’ll need to edit field values on the Edit Form.

What is the updated way to do this in the modern forms?

It says the $el doesn't exist.

Never mind. I forgot to use the fd.spRendered().

2 Likes