Skip to main content
Nintex Community Menu Bar
Solved

Using external JavaScript Libraries in SmartForms


So there have been a few posts regarding JavaScript libraries but it never seems like they are conclusive.
I have tried to use a few external JavaScript libraries but they never work, even with CrossSite Scripting turned off (in K2 Five since anything before that does not have that option). My latest attempt is trying to utilize a javascript library called SpaceTime that allows conversion of time to different timezones.
I have attached a really small script for converting the current time to Eastern Time, and the script works if you open it in a browser, and it works anywhere else javascript is interpreted, but if I stick it in a Data Label and set it to Literal, it does not work.

I have also tried to use other external JavaScript libraries before, such as the Google Charts library, Charts.js, and others, but they never work. Am i misusing it somehow or is it just not supported?

Best answer by boringNerd1

You can try downloading the javascript, and place it on the server that is hosting your K2 SmartForms Runtime. Place the js file in <K2 install dir>/K2 SmartForms Runtime/Styles/Themes, then in your <script> src, change it to "="/Runtime/Styles/Themes/spacetime.js".


 


To check if the js file has been loaded, use Chrome, press F12, go to Network tab, start recording, and refresh your form. Once the form is loaded, check the network trace is spacetime.js has been loaded. Check my attachment.


 


View original
Translate
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+15
  • 498 replies
  • Answer
  • January 7, 2019

You can try downloading the javascript, and place it on the server that is hosting your K2 SmartForms Runtime. Place the js file in <K2 install dir>/K2 SmartForms Runtime/Styles/Themes, then in your <script> src, change it to "="/Runtime/Styles/Themes/spacetime.js".


 


To check if the js file has been loaded, use Chrome, press F12, go to Network tab, start recording, and refresh your form. Once the form is loaded, check the network trace is spacetime.js has been loaded. Check my attachment.


 


Translate

Forum|alt.badge.img+11
  • 658 replies
  • January 7, 2019

Not sure your end goal, but SmartForms controls that are DateTime aware automatically adjust the displayed value for the time zone of the user looking at the page.

Translate

  • Author
  • 40 replies
  • January 7, 2019

My end goal was to have the user select the time and date on a calendar control and then to simuntaneously display other relevant time zones in a different control, such as pictured below.

 

 

 

The reason for doing something like this is because it's a product to schedule event sessions, and there is about 4 different US States involved, so it can become confusing real quick dealing with scheduling things in other timezones

I managed to make it happen but without the use of the SpaceTime JS Library, I ended  up using the native Date().toLocaleString() which I was not aware of.

Translate

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings