Extracting specific value for read-only fields

Hi,

I have a requirement where I need to pull through only the date value in a read-Only field.

As you can see from the the two images, the dates are being pulled through from a SP field and displayed as 'Read-Only' for the User to 'review' the content.

The 1st image is using a plain-text field and the second example is using a date field. I would like to keep the plain-text field option for my read-only field option and have a format of 'Wed Mar 09 2022' as opposed to the second image.

Is this possible?

Here is my problem:

image
image

Here is the code I am using to do the Lookup:

 fd.spRendered(function() {   
fd.field('REffectiveDates').disabled = true
	fd.field('Effective_Date').$on('change', function() {
 	fd.field('REffectiveDates').value = fd.field('Effective_Date').value; 
	})
});

Dear @DryChips,
Should be possible, try:
fd.field('REffectiveDates').value = fd.field('Effective_Date').value.toDateString();

1 Like

Hi,

Thanks for this. Do I need to remove any code or just add this after this code:

fd.field('REffectiveDates').value = fd.field('Effective_Date').value;

Dear @DryChips,
I don't know what fields are what - this is just an example. If the Effective_Date is a Date type field, you can then retrieve its value as a Date string, and use it in another field, for example, in a text field.

Why would you need this line?
fd.field('REffectiveDates').value = fd.field('Effective_Date').value;

If the next line is going to re-assign the value for you?
fd.field('REffectiveDates').value = fd.field('Effective_Date').value.toDateString();

You can leave this line, but it is going to be overwritten by the next one, it wouldn't do anything. I would recommend removing the old line.

1 Like

Hi,

Its cool! Thank you.