Advertisement
commodore73

Contentstack Read-Only Custom Field or Widget

Apr 12th, 2021 (edited)
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.06 KB | None | 0 0
  1. <html>
  2.   <head>
  3.     <meta name="viewport"
  4.      content="width=device-width, initial-scale=1.0" />
  5.     <link rel="stylesheet" type="text/css" media="all"
  6.      href="https://www.contentstack.com/sdks/contentstack-ui-extensions/dist/latest/ui-extension-sdk.css"></script>
  7.     <script type="text/javascript"
  8.      src="https://www.contentstack.com/sdks/contentstack-ui-extensions/dist/latest/ui-extension-sdk.js"></script>
  9.   </head>
  10.   <body>
  11.     <div id="usermessage"></div>
  12.     <script type="text/javascript">
  13. ContentstackUIExtension.init().then(function(extension)
  14. {
  15.   extension.window.updateHeight(300); // comment this line to use this code as a widget
  16.   extension.window.enableAutoResizing(); // comment this line to use this code as a widget
  17.   document.getElementById("usermessage").innerHTML =
  18.     extension.field.getData(); // value for custom field - comment this line to use this code as a widget
  19. //    extension.entry._data["fieldname"]; // field from entry for widget - enable this line to use this code as a widget
  20. });
  21.     </script>
  22.   </body>
  23. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement