Landing Page: Need to alter the format of the custom fields in Editor section

Avatar

Avatar

Anita_p

MVP

Avatar

Anita_p

MVP

Anita_p
MVP

15-07-2019

Hi ,

I am working upon a landing page and I have a custom field in the recipient schema of type DateTime .

During run time I want the value to be displayed in DD Month YYYY.

I have tried changing the format using JS but somehow the landing page does not allow to alter anything the values visible at the Editor section of the landing page

The same works all fine which is not shown in the editor.

PFB screenshots for your reference:

Screen Shot 2019-07-16 at 9.58.43 am.png

in the source code, it appears as below and I tried using the variable here to have it displayed in the required format but no luck.

Screen Shot 2019-07-16 at 10.04.46 am.png

Any suggestions what changes I need to do in the above code ?

Thanks in advance.

Regards,

Anita

Replies

Avatar

Avatar

wodnicki

MVP

Avatar

wodnicki

MVP

wodnicki
MVP

18-07-2019

Hi,

Put this at the bottom of the page source, where #id is the id value of the date node, here 'span156....':

<script type="text/javascript">// <![CDATA[

$(function(){

  $('#id').val(new Date($('#id').val().replace(' ', 'T')).toLocaleString('en-US', {year:'numeric', month:'long', day:'numeric'}));

})

// ]]></script>

Thanks,

-Jon

Avatar

Avatar

Anita_p

MVP

Avatar

Anita_p

MVP

Anita_p
MVP

21-07-2019

Thanks Jon.  Appreciate your response.

I tried using some other method and it worked.

Regards,

Anita